EGL library strLib

The strLib functions manipulate and convert data to and from STRING variables and format date/time variables.

The following table shows the system functions in the strLib library. Subsequent tables show the strLib variables and constants.

Table 1. strLib system functions
System function and invocation Description
result = booleanAsString (value ) Returns the string "true" or the string "false" based on a Boolean value.
result = byteLen (source ) Returns the number of bytes in a variable, excluding any trailing spaces and null values.
result = characterLen (source) Returns the number of characters in a text expression, excluding any trailing spaces or null values.
result = charAsInt (text ) Returns an integer code point corresponding to a character.
result = clip (text [, code]) Deletes leading/trailing blanks and nulls from character strings.

result  = formatDate (dateValue
[, dateFormat
])

Formats a DATE value and returns a STRING value.

result  = formatNumber (numericExpression,
numericFormat)

Returns a number as a formatted string.

result  = formatTime (timeValue
[, timeFormat])

Formats a parameter into a time value and returns a STRING value. The default format is the format specified in the current locale.

result  = formatTimestamp (timestampValue
[, timestampFormat])

Formats a parameter into a timestamp value and returns a value of type STRING. The DB2® format is the default format.

token = getNextToken (source, index,
delimiters)
result = getNextToken (target, source, index,
subStringLength, delimiters)

Returns the next token in a string.
result = getTokenCount (source, delimiters) Returns the number of tokens in a source string.
result = indexOf (source, pattern [, startPosition] ) Returns an index into a string of characters. The index indicates where a specified pattern begins.
result = intAsChar (integer) Returns a character that corresponds to an integer code point.
result = intAsUnicode (integer) Returns a Unicode character that corresponds to an integer code point.
result = lowerCase (text) Converts all uppercase values in a character string to lowercase values.
setBlankTerminator (target) Replaces a null terminator and any subsequent characters in a string with spaces.
setNullTerminator (target) Changes all trailing spaces in a string to null values.
result =spaces (characterCount) Returns a string of a specified length.
result = unicodeAsInt (integer) Returns an integer that corresponds to a Unicode character.
result = upperCase (text) Converts all lowercase values in a character string to uppercase values. Numeric and existing uppercase values are not affected.

Variables

The following table shows the system variables in the strLib library.

Table 2. strLib system variables
System variable Description
defaultDateFormat Specifies a default pattern to convert a DATE to text.
defaultMoneyFormat Specifies a default pattern to convert a MONEY type to text.
defaultNumericFormat Specifies a default pattern to convert a number to text.
defaultTimeFormat Specifies a default pattern to convert a TIME to text.
defaultTimestampFormat Specifies a default pattern to convert a TIMESTAMP to text.

Constants

The following table shows the system constants in the strLib library.

Table 3. strLib system constants (STRING type)
System constant Description
db2TimestampFormat The pattern yyyy-MM-dd-HH.mm.ss.SSSSSS, which is the IBM® DB2 default timestamp format.
eurDateFormat The pattern dd.MM.yyyy, which is the IBM European standard date format.
eurTimeFormat The pattern HH.mm.ss, which is the IBM European standard time format.
isoDateFormat The pattern yyyy-MM-dd, which is the date format that the International Standards Organization (ISO) specifies.
isoTimeFormat The pattern HH.mm.ss, which is the time format that the International Standards Organization (ISO) specifies.
jisDateFormat The pattern yyyy-MM-dd, which is the Japanese Industrial Standard date format.
jisTimeFormat The pattern HH:mm:ss, which is the Japanese Industrial Standard time format.
nullFill The empty string (""), which is used to initialize a character variable to a null value.
odbcTimestampFormat The pattern yyyy-MM-dd HH:mm:ss.SSSSSS, which is the Open Database Connectivity timestamp format.
usaDateFormat The pattern MM/dd/yyyy, which is the IBM USA standard date format.
usaTimeFormat The pattern hh:mm a, which is the IBM USA standard time format.

Compatibility

Table 4. Compatibility considerations for strLib
Platform Issue
Rich UI The following strLib functions are not supported:
  • byteLen
  • charAsInt
  • defaultMoneyForm
  • defaultNumericFormat
  • formatNumber
  • getNextToken
  • getTokenCount
  • intAsChar
  • intAsUnicode
  • setBlankTerminator
  • setNullTerminator
  • unicodeAsInt

Feedback