IBM 15 Switch User Manual


 
142
Chapter 8
In CLEM, a string is any sequence of characters between matching double quotation marks
("string quot
es"). Characters (CHAR) can be any single alphanumeric character. They are declared
in CLEM expressions using single backquotes in the form of `<character>`, such as `z`, `A`, or `2`.
Charac ters that are out-of-bounds or negative indices to a string will result in undened behavior.
Note. Compar
isons between s trings that do and do not use SQL pushback may generate different
results where tra iling spaces exist.
Function
Result
Description
allbutfirst(N, STRING)
String
Returns a string , which is STRING with the
rst N characters removed.
allbutlast(N, STRING)
String
Returns a string , which is STRING with the
last characters removed.
alphabefore(STRING1, STRING2)
Boolean
Used to check the alphabeti cal ordering of
strings. Returns true if STRING1 precedes
STRING2.
endstring(LENGTH, STRING)
String
Extracts the last N characters from the
specied st ring. If the string length is less
than or equal to th e specied length, then it
is unchanged.
hasendstring(STRING, SUBSTRING)
Integer
This function is the same as
isendstring(SUBSTRING, STRING).
hasmidstring(STRING, SUBSTRING)
Integer
This function is the same as
ismidstring(SUBSTRING, STRING)
(embedded substring).
hasstartstring(STRING, SUBSTRING)
Integer
This function is the same as
isstartstring(SUBSTRING, STRING).
hassubstring(STRING, N, SUBSTRING)
Integer
This func
tion is the same as
issubstring(SUBSTRING, N, STRING),
where N defaults to 1.
count_substring(STRING, SUBSTRING)
Integer
Returns the number of times the specied
substring occurs within the string. For
example,
count_substring("foooo.txt", "oo") returns 3.
hassubstring(STRING, SUBSTRING)
Integer
This function is the same as
issubstring(SUBSTRING, 1, STRING),
where N defaults to 1.
isalphacode(CHAR)
Boolean
Returns a value of true if CHAR is a character
in the specied string (often a eld name)
whose character code is a letter. Otherwise,
this function returns a value of 0. For
example, isalphacode(produce_num(1)).
isendstring(SUBSTRING, STRING)
Integer
If the string STRING ends with the substring
SUBSTRING, then this function returns the
integer subscript of SUBSTRING in STRING.
Otherwise, this function returns a value of 0.
islowercode(CHAR)
Boolean
Returns a value of true if CHAR is a
lowercase letter character for the sp eci ed
string (often a eld name). Otherwise,
this function returns a value of 0. For
example, both islowercode(``) and
islowercode(country_name(2)) are valid
expressions.