Obtains the index of the first ocurrence of a word in the text and returns its position.

1 string.indexOfWord

<string.indexOfWord>    <text /> !    <word /> !</string.indexOfWord>

Exceptions

The 2 entry parameters has not been specified.

Remarks

This function only obtains the searched text if is between spaces, that is, if it is found in isolation in the text, otherwise it returns -1.

Example

Obtains the index to a word in the text and returns its position.

Copy
<xsql-script name='string_indexOfWord'>
<body>
<set name='text'>The students played basketball in the stadium next to the church</set>
<set name='word'>de</set>
<println>
<string.indexOfWord>
<text /><word />
</string.indexOfWord>
</println>
</body>
</xsql-script>

Returns:

Copy
51