Substrings

Three functions are available to return part of a string. The substring function returns a substring based on a starting position (starting at 1 not 0) and optionally a length. For example:

substring("query", 2, 3)

returns the string uer. If no length is specified, the function returns the rest of the string. For example:

substring("query", 2)

returns uery.

The substring-before function returns all the characters of a string that occur before the first occurrence of another specified string. The substring-after function returns all the characters of a string that occur after the first occurrence of another specified string. Table 17-4 shows examples of the substring functions.

Table 17-4. Examples of the substring functions

Example

Return value

substring("query", 2, 3)

uer

substring("query", 2)

uery

substring-before("query", "er")

qu

substring-before("queryquery", "er")

qu

substring-after("query", "er")

y

substring-after("queryquery", "er")

yquery

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.58.116.51