String IndexOf Example
Demonstrates the IndexOf viper by iterating the string using the dowhile macro.
| Smartsite SXML |
|
|---|---|
{buffer.set(data, 'The rain in Spain falls mainly in the plain')}
{buffer.set(position, -1)}
<se:dowhile expression="buffer.get(position) != -1">
{buffer.set(position, string.indexof($data, ain, $position + 1))}
Substring found at {buffer.get(position)}<br />
</se:dowhile>
|
|
| Example Result |
|
|---|---|
Substring found at 5<br />
Substring found at 14<br />
Substring found at 25<br />
Substring found at 40<br />
Substring found at -1<br />
|
|