基础 > 基础 > 关系和参数 > 关系 (Relations) > 关系中使用的运算符和函数 > 字符串运算符和函数
字符串运算符和函数
字符串可以使用下列运算符和函数:
==比较字符串相等。
!=, <>, ~=比较字符串不等。
+合并字符串。
itos(int)将整数转换为字符串。
其中,int 可以是一个数字或表达
式。
对非整数进行四舍五入。
search(string, substring)搜索子串。
结果值是子串在串中的位置 (如未找到,返回
0)。
extract(string, position, length)提取一个子串。
例如:
如果 param = abcdef,则:
•flag = param == abcdef 返回 TRUE
•flag = abcdef != ghi 返回 TRUE
•new = param + ghi new 是 abcdefghi
•new = itos(10 + 7) new 是 17
•new = param + itos(1.5) new 是 abcdef2
•where = search(param, bcd) where 是 2
•where = search(param, bcd) where 是 0
•new = extract(param,2,3) new 是 bcd
注意: 如果用户使用参数值为零 (0) 的 itos 函数,则返回值将为空字符串。
以下示例对 itos 函数进行了说明:
integer_param = 4
string_param = itos(integer_param)
/*string_param 将返回 4 */
integer_param = -7
string_param = itos(int_param)
/*string_param 将返回 7 */
对于零 (0) 值整数,itos 函数将返回一个空 ("") 值,如下所示:
integer_param = 0
string_param = itos(int_param)
/*string_param 将返回一个空字符串 ("") */
要返回一个零字符串值 ("0"),可使用下面的 IF 语句:
integer_param = 0
string_param = itos(integer_param)
IF string_param == "" string_param = "0" ENDIF。