Edit online

Substring of Text: oxy_substring() Function

This function is used to return a string of text.

The oxy_substring() function has two signatures:

Syntax 1:
oxy_substring ( text , startOffset )

Returns a new string that is a substring of the original text string. It begins with the character at the specified index and extends to the end of text string.

text
The original string.
startOffset
The beginning index, inclusive
Syntax 2:
substring ( text , startOffset , endOffset )

Returns a new string that is a substring of the original text string. The substring begins at the specified startOffset and extends to the character at index endOffset - 1.

text
The original string.
startOffset
The beginning index, inclusive.
endOffset
The ending index, exclusive.

Example: oxy_substring Function

oxy_substring('abcd', 1) returns the string 'bcd'.

oxy_substring('abcd', 4) returns an empty string.

oxy_substring('abcd', 1, 3) returns the string 'bc'.

If you only want to display part of an attribute value, for instance the part that comes before an Appendix string:
image[longdesc]{
 content: oxy_substring(attr(longdesc), 0, 
          oxy_indexof(attr(longdesc), "Appendix"));
}