| 
     << Click to Display Table of Contents >> 文本函数 | 
    
    
     ![]() ![]()  
     | 
  
函数  | 
语法  | 
说明  | 
举例  | 
|---|---|---|---|
ascii  | 
ascii(string)  | 
返回 string 的第一个字符的 ascii 码  | 
例如: ascii('A') = 65  | 
char  | 
char(number)  | 
返回通过 ascii 代码 number 编码的字符  | 
例如: char(65) = 'A'  | 
concat  | 
concat(string1,string2..)  | 
拼接多个字符串  | 
例如:concat("yonghong","company")=yonghongcompany  | 
contains  | 
contains(string, substring)  | 
如果给定字符串包含指定子字符串,则返回 true  | 
例如: contains("Calculation", "alcu") = true  | 
endsWith  | 
endsWith(string, substring)  | 
如果给定字符串以指定子字符串结尾,则返回 true, 否则就是false  | 
例如: endsWith("yonghong", "ghon")=false  | 
exact  | 
exact(string1,string2)  | 
比较两个字符串是否相同,如果相同则返回true,不同则返回false string1 需要比较的字符串1 string2 需要比较的字符串2  | 
例如: exact("Hello World Java", "Hello World Java")=true  | 
extractNTH  | 
extractNTH(string, regex, index)  | 
 对源字符串匹配正则表达式,并返回对应匹配到的子字符串 string需要处理的字符串 regex需要匹配的正则表达式,如匹配空白字符:"\s" index需要返回匹配的第n个捕获组,如果是0则返回整个字符串  | 
例如: 获取匹配到的第2个捕获组"World",如下所示 extractNTH("Hello World", "([A-z]+)\\s+([A-z]+)", 2)=World  | 
find  | 
find(string, substring, [start])  | 
 返回 substring 在 string 中的索引位置,如果未找到 substring,则返回 0。如果添加了可选参数 start,则函数会忽略在索引位置 start 之前出现的任何 substring 实例。字符串中第一个字符的位置为 1 
  | 
例如: find("Calculation", "alcu") = 2  | 
indexOf  | 
indexOf(string, substring)  | 
返回 substring 在 string 中的索引位置,如果未找到 substring,则返回 0  | 
例如: indexOf("hello world", "o")=5  | 
left  | 
left(string, number)  | 
返回字符串最左侧一定数量的字符  | 
例如: left("matador", 4) = "mata"  | 
len  | 
len(string)  | 
返回字符串长度  | 
例如: len("matador") = 7  | 
lower  | 
lower(string)  | 
返回 string,其所有字符为小写  | 
例如: lower("ProductVersion") = productversion  | 
match  | 
match(string, regex)  | 
如果源字符串匹配正则表达式,则返回true,否则返回false string 需要处理的字符串 regex需要匹配的正则表达式,如匹配空白字符:"\s"  | 
例如: 源字符串匹配正则表达式,则返回true match("Hello World","([A-z]+)\sWorld")=true  | 
mid  | 
 mid(string, start,[length]) 
  | 
返回从索引位置 start 开始的字符串。字符串中第一个字符的位置为 1。如果添加了可选参数 length,则返回的字符串仅包含该数量的字符  | 
例如: mid("calculation", 2) = "alculation" mid("calculation", 2, 5) ="alcul"  | 
replace  | 
replace(string, substring, replacement)  | 
在 string 中搜索 substring 并将其替换为 replacement。如果未找到 substring,则字符串保持不变  | 
例如: replace("version8.5", "8.5", "9.0") = "version9.0"  | 
replaceRegex  | 
replaceRegex(string,regex,replacement)  | 
对源字符串匹配正则表达式,并返回替换后的字符串 string需要处理的字符串 regex需要匹配的正则表达式,如匹配空白字符:"\s" replacement替换的字符串  | 
例如: 替换空格为"*",返回字符串"hello*world": replaceRegex("hello world", "\s", "*")=hello*world  | 
rept  | 
rept(string,number)  | 
按指定次数重复字符串 string 需要处理的字符串 number重复的次数  | 
例如: rept("*-", 3)=*-*-*-  | 
right  | 
right(string, number)  | 
返回 string 中最右侧一定数量的字符  | 
例如: right("calculation", 4) = tion  | 
search  | 
search(find_string, with_string, [start_num] )  | 
返回一个字符串在另一个字符串第一次出现的位置(不区分大小写) find_string查找的字符串 with_string被查找的字符串 start_num 可选参数,开始查找的位置,默认为1  | 
例如: 从字符串的第6位开始查找字符串"o",返回所在位置8: search("o", "hello world", 6)=8  | 
split  | 
split(string, delimiter, token number)  | 
返回字符串中的一个子字符串,并使用分隔符字符将字符串分为一系列标记  | 
例如: split('a-b-c-d','-', 2) = b  | 
startsWith  | 
startsWith(string, substring)  | 
如果 string 以 substring 开头,则返回 true  | 
例如: startsWith("Yonghong", "Yon")=true  | 
substitute  | 
substitute(string, old_str, new_str, times)  | 
用新字符串替换源字符串中的部分字符串 string 需要处理的字符串 old_str要被替换的字符串 new_str替换的字符串 times可选参数,替换的第几个字符串,默认0  | 
例如: 如何将"world"字符串替换为"earth"替换一次,返回字符串"hello earth hello world": substitute("hello world hello world", "world", "earth",1)=hello earth hello world  | 
substring  | 
substring(string, start_position, [length])  | 
返回某个指定位置的字符串的子集 string:给定的字符串 start_position:一个非负的整数,规定要提取的子串的第一个字符在给定的字符串中的位置 length:可选,非负的整数。如果省略该参数,那么返回的子串会一直到字符串的结尾  | 
例如: substring("Hello World",1, 3)=Hel  | 
trim  | 
trim(string)  | 
返回移除了前导和尾随空格的字符串  | 
例如: trim(" calculation ") = "calculation"  | 
upper  | 
upper(string)  | 
返回字符串,其所有字符为大写  | 
例如: upper("calculation") = "CALCULATION"  |