Use the following functions to perform string manipulation within expressions.
Returns the position of a string within another string.
The following function returns 3.
<indexOf> <s>abcabc</s> <s>abc</s> <s>l</s> </indexOf>
Concatenates two or more string values.
The following expression returns <s>Now is the time</s>.
<concat> <s>Now </s><s>is </s><s>the </s><s>time</s> </concat>
Takes a single argument, which is coerced to a string. It returns a copy of the argument with all upper case letters converted to lower case.
The following expression returns <s>abc</s>.
<downcase><s>ABC</s></downcase>
Returns the number of elements in the list. You can also use this function to return the length of a string.
first argument– list or string
The following expression returns 2.
<length> <list> <s>apples</s> <s>oranges</s> </list> </length>
<length> <s>Hello world!</s> </length>
This expression returns a value of 11.
Takes a single argument, which is coerced to a string.
It returns a copy of the argument with the leading white space removed.
The following expression returns <s>hello</s>.
<ltrim><s> hello</s></ltrim>
Deprecated. Use the contains function instead.
Formats a message by message catalog key.
<message severity-’ok’ name=’DEFAULT_MESSAGE’> <!--message parameter 0--> <!--message parameter n--> </message>
Pads a string with spaces so that it reaches a desired length.
first argument– the string to pad
second argument– desired length
third argument– (optional) specifies the pad character, which by default is a space
The following expression results in <s> email </s>
<pad> <s> email</s> <i>10</i> </pad>
Takes a single argument, which is coerced to a string. It returns a copy of the argument with the trailing white space removed.
This example returns 0 (zero).
<cmp> <s>hello</s><rtrim><s>hello </s></rtrim> </cmp>
Splits a string into a list of strings.
first argument– string to be split
second argument– a set of one or more string delimiters. Each character in this string will cause a break.
A list is created that contains each substring between delimiters.
<split> <s>Austin City Limits</s> <s> </s> </split>
This expression returns the following list.
<list> <s>Austin</s> <s>City</s> <s>Limits</s> </list>
The following expression uses multiple delimiters.
<split> <s>(512)338-1818</s> <s>()-</s> </split>
This expression returns the following list.
<list> <s>512</s> <s>338</s> <s>1818</s> </list>
Extracts ranges of characters from a string.
This function takes two forms:
start and length are specified as arguments (child nodes of the substr element).
start and length are specified as attributes of the substr node s for start and l for length.
For example, these two invocations are equivalent:
<substr> <s>Hello World</s> <i>3</i> <i>4</i> <substr>
and
<substr s=’3’ l=’4’> <s>Hello World</s> <substr>
Both functions return the string lo W.
<block> <substr s=’3’ l=’4’> <s>Hello World</s> --> Hello World </substr> --> lo W </block> --> lo W
The start and length parameters are optional. If the start argument is missing, either because only the string is specified as a child of the substr node as in
<substr> <s>Hello World</s> <substr>
and the attribute s is also missing from the substr node, the start is assumed to be the beginning of the string. In other words, its value is zero if not specified explicitly.
first argument– string
second argument– starting position
third argument– number of characters to retrieve
The following expression returns <s>Now</s>.
<substr> <s>Now is the time</s> <i>0</i> <i>3</i> </substr>
In the following example, the start attribute is missing, but is assumed to be 0:
<block> <substr l=’4’> <s>Hello World</s> --> Hello World </substr> --> Hell </block> --> Hell
The length argument is also optional. A missing length argument causes the function to extract the rest of the string. length can be unspecified when only the string and start arguments are specified a child nodes of substr such as:
<substr> <s>Hello World</s> <i>3</i> <substr>
or when the l attribute is missing from the substr node like. Note that the length argument is unspecified below, but the rest of the string starting from this start is returned:
<block> <substr s=’3’> <s>Hello World</s> --> Hello World </substr> --> lo World </block> --> lo World
Takes a single argument, which is coerced to a string.
It returns a copy of the argument with the leading and trailing white space removed.
The following expression returns <s>hello</s>.
<trim><s> hello </s></trim>
Takes a single argument, which is coerced to a string.
It returns a copy of the argument with all lower case letters converted to upper case.
The following expression returns <s>ABC</s>.
<upcase><s>abc</s></upcase>
Returns the string value of the subexpression with leading zeros removed.
<ztrim> <s>00000sample</s> </ztrim> This function evaluates to <s>sample</s>.