IBM 15 Switch User Manual


 
144
Chapter 8
Function
Result
Description
locchar(CHAR, N, STRING)
Integer
Used to identify the locati on of characters
in symbolic elds. The function searches
the string STRING for the character CHAR,
starting the search at the Nth character
of STRING. This function returns a value
indicating the locati on (starting at N) where
the character is found. If the character is not
found, thi s function return s a value of 0. If
the function has an invalid offset (N) (for
example, an offset that is beyond the length
of the string), this function returns $null$.
For example, locchar(`n`, 2, web_page)
searches the eld called web_page for the `n`
character beginning at the second character
in the eld value.
Note: Be sure to u se single backquotes to
encapsulate the specied character.
locchar_back(CHAR, N, STRING)
Integer
Similar to locchar, except that the search is
performed backward starting f rom the Nth
character. For example, locchar_back(`n`,
9, web_page) searches the eld web_page
starting from the ninth character and moving
backward toward the s t art of the string.
If the function has an invalid offset (for
example, an offset that is beyond the length
of the string), this function returns $null$.
Ideally, you should u se locchar_back in
conjunction with the function length(<field>)
to dynamically us e the length of the
current value of the eld. For example,
locchar_back(`n`, (length(web_page)),
web_page).
lowertoupper(CHAR)
lowertoupper (STRING)
CHAR or
String
Input can be either a string or character,
which is used in this function to return
a new item of the same type, with any
lowercase characters converted to their
uppercase equivalents. For example,
lowertoupper(`a`), lowertoupper(“My
string”), and lowertoupper(field_name(2))
are all valid expressions.
matches
Boolean
Returns tru e i f a string matches a specied
pattern. The pattern must be a string lit eral;
it cannot be a eld name containing a pattern.
A question mark (?) can be included in the
pattern t o match exactly one ch aracter; an
asterisk (*) matches zero or more characters.
To match a literal question mark or asterisk
(rather than using these as wildcards), a
backslash (\) can be used as an escape
character.
replace(SUBSTRING, NEWSUBSTRING,
STRING)
String
Within the specied STRING, replace
all instances of SUBSTRING with
NEWSUBSTRING.
replicate(COUNT, STRING)
String
Returns a string that consists of the original
string copied the specied number of times.