You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在DataStage中移除字段中的小数点?

移除字段中的小数点实现方法

以下是几种常见场景下的解决办法,按需选用:

Excel 场景

  • 使用SUBSTITUTE函数直接替换小数点:
    在目标单元格输入公式 =SUBSTITUTE(A1,".",""),其中A1是包含目标文本的单元格。执行后D21.3会直接转换为D213,批量处理下拉公式即可。

Python 场景

  • 单字符串处理:
    s = "D21.3"
    result = s.replace(".", "")
    print(result)  # 输出 D213
    
  • 批量处理列表中的字段:
    data_list = ["D21.3", "A5.67", "B0.9"]
    processed_list = [item.replace(".", "") for item in data_list]
    print(processed_list)  # 输出 ['D213', 'A567', 'B09']
    

JavaScript 场景

  • 单个字符串处理(支持全局替换多个小数点):
    let str = "D21.3";
    let result = str.replace(/\./g, "");
    console.log(result);  // 输出 D213
    

内容的提问来源于stack exchange,提问作者Krishna

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.07 20:25:27