Edit online

Indexing: oxy_indexof() Function

This function is used to define searches.

The oxy_indexof() function has two signatures:

Syntax 1:
oxy_indexof ( text , toFind )

Returns the index within text string of the first occurrence of the toFind substring.

text
Text to search in.
toFind
The searched substring.
Syntax 2:
oxy_indexof ( text , toFind , fromOffset )

Returns the index within text string of the first occurrence of the toFind substring. The search starts from fromOffset index.

text
Text to search in.
toFind
The searched substring.
fromOffset
The index to start the search from.

Example: oxy_indexof Function

oxy_indexof('abcd', 'bc') returns 1.

oxy_indexof('abcdbc', 'bc', 2) returns 4.

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"));
}