EGL 库 StrLib

下表显示库 StrLib 中的系统函数,并且该表后面的表将显示该库中的变量和常量。

系统函数和调用 描述
result = characterAsInt (text ) 将字符串转换为与字符表达式中的第一个字符相对应的整数字符串。
result = clip (text ) 删除返回的字符串的结束位置的结尾空格和空值
result = compareStr (target, targetSubstringIndex, targetSubstringLength, source, sourceSubstringIndex, sourceSubstringLength) 在运行时,根据两个子串的 ASCII 或 EBCDIC 顺序来对它们进行比较,并返回值(-1、0 或 1)以指出哪个值较大。
result = concatenate (target , source) targetsource 并置;将新字符串放在 target 中;并返回一个整数以指出 target 的长度是否足以包含新字符串
result = concatenateWithSeparator (target, source, separator) 通过在 targetsource 之间插入 separator 来将它们并置;将新字符串放到 target 中;并返回一个整数以指出 target 的长度是否足以包含新字符串
copyStr (target, targetSubstringIndex, targetSubstringLength, source, sourceSubstringIndex, sourceSubstringLength) 将一个子串复制至另一个子串
result = findStr (source, sourceSubstringIndex, sourceSubstringLength, searchString) 搜索子串在字符串中的第一次出现

result = formatDate (dateValue
[, dateFormat
])

定义日期值的格式并返回类型为 STRING 的值。缺省格式为当前语言环境中指定的格式。

result = formatNumber (numericExpression,
numericFormat)

返回格式字符串形式的数字。

result = formatTime (timeValue
[, timeFormat])

将参数的格式定义为时间值并返回类型为 STRING 的值。缺省格式为当前语言环境中指定的格式。

result = formatTimeStamp (timeStampValue
[, timeStampFormat])

将参数的格式定义为时间戳记值并返回类型为 STRING 的值。DB2® 格式为缺省格式。
result = getNextToken (target, source, sourceSubstringIndex, sourceStringLength, characterDelimiter) 在字符串中搜索下一个记号并将该记号复制至 target
result = integerAsChar (integer) 将整数字符串转换为字符串。
result = lowerCase (text) 将字符串中的所有大写值转换为小写值。数字和现有小写值不受影响。
setBlankTerminator (target) 将字符串中的 NULL 终止符以及任何后续字符都替换为空格,以使 C 或 C++ 程序返回的字符串值在 EGL 生成的程序中能够正确地工作
setNullTerminator (target) 将字符串中的所有结尾空格更改为 NULL
setSubStr (target, targetSubstringIndex, targetSubstringLength, source) 用指定的字符替换子串中的每个字符
result =spaces (characterCount) 返回指定长度的字符串。
result = strLen (source) 返回一个项中的字节数,不包括任何结尾空格或 NULL
result = textLen (source) 返回文本表达式中的字节数,不包括任何结尾空格或 NULL
result = upperCase (characterItem) 将字符串中的所有小写值转换为大写值。数字和现有大写值不受影响。

下表显示库 StrLib 中的系统变量。

系统变量 描述
defaultDateFormat 指定 defaultDateFormat 的值,它是一种掩码,可以用来创建由函数 StrLib.formatDate 返回的字符串。
defaultMoneyFormat 指定 defaultMoneyFormat 的值,它是一种掩码,可以用来创建由函数 StrLib.formatNumber 返回的字符串。
defaultNumericFormat 指定 defaultNumericFormat 的值,它是一种掩码,可以用来创建由函数 StrLib.formatNumber 返回的字符串。
defaultTimeFormat 指定 defaultTimeFormat 的值,它是一种掩码,可以用来创建由函数 StrLib.formatTime 返回的字符串。
defaultTimestampFormat 指定 defaultTimestampFormat 的值,它是一种掩码,可以用来创建由函数 StrLib.formatTimestamp 返回的字符串。

下表显示库 StrLib 中的系统常量。所有常量都属于 STRING 类型。

系统变量 描述
db2TimestampFormat 模式 yyyy-MM-dd-HH.mm.ss.ffffff,这是 IBM® DB2 缺省时间戳记格式。
eurDateFormat 模式 dd.MM.yyyy,这是 IBM 欧洲标准日期格式。
eurTimeFormat 模式 HH.mm.ss,这是 IBM 欧洲标准时间格式。
isoDateFormat 模式 yyyy-MM-dd,这是国际标准组织(ISO)指定的日期格式。
isoTimeFormat 模式 HH.mm.ss,这是国际标准组织(ISO)指定的时间格式。
jisDateFormat 模式 yyyy-MM-dd,这是日本工业标准日期格式。
jisTimeFormat 模式 HH:mm:ss,这是日本工业标准时间格式。
odbcTimestampFormat 模式 yyyy-MM-dd HH:mm:ss.ffffff,这是 ODBC 时间戳记格式。
usaDateFormat 模式 MM/dd/yyyy,这是 IBM 美国标准日期格式。
usaTimeFormat 模式 hh:mm AM,这是 IBM 美国标准时间格式。

相关参考
formatDate()
formatNumber()
formatTime()
formatTimeStamp()

使用条款 | 反馈
(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.