oxy_substring() Function

This function is used to return a string of text.

The oxy_substring() function has two signatures:

  • 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

  • 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.

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 we only want to display part of an attribute value, the part that comes before an Appendix string:

image[longdesc]{
 content: oxy_substring(attr(longdesc), 0, 
          oxy_indexof(attr(longdesc), "Appendix"));
}

Was this helpful?