oxy_indexof()
Function
The oxy_indexof()
function has two signatures:
-
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.
-
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.
oxy_indexof('abcd', 'bc')
returns 1.
oxy_indexof('abcdbc', 'bc', 2)
returns 4.
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")); }