天软金融分析.NET函数大全 > TSL函数 > 基础函数 > 字符串 > 替换以及处理函数

ReplaceText    

简述

字符串的部分替换。将一个字符串Atext中第一次遍历时存在的AFromText全部替换为AToText部分。本函数不支持多语言。

注意:这种判定是基于大小写不敏感,并且这种替换不是递归处理的,就是说,替换一遍以后不再寻找匹配的AFromText再次替换成AtoText字符串。
定义
ReplaceText(AText; AFromText; AToText: String): String;
参数
名称类型说明
AText String字符串类型,源串
AFromText String字符串类型,被替换内容
AToText String字符串类型,替换内容
返回 String
字符串
  • 范例




    AText := "The first letter will be replaced by \'one\', but the second letter won't.";

    AFromText := "letter";

    AToText := "one";

    Return ReplaceText(AText, AFromText, AToText);

    //输出:The first one will be replaced by 'one', but the second one won't.n

相关