Pos
Description:
Format:
Pos (string Source, string Search, integer Start)
|
Parameters: |
Stringr |
Source |
Source string which contains the Search. |
|
String |
Search |
Search string to find in Source string. |
|
|
Integer |
Start (optional) |
Starting position to begin looking for Search string within Source string.. |
|
|
Return Value: |
Integer |
Position |
Starting position of the Search string within the Source string. |
Usage:
Example 1:
Make a decision based on whether the Document's Text contains the words 'File Not Found'.
String strResult
If Pos(GetDocumentText(), 'File Not Found') > 0
MessageBox ('Error', 'The document was not found!')
EndIf
Example 2:
String strPhrases
String strResult
strPhrases = 'Super Widgets, Long Widgets, Soft Widgets'
strResult = Left(strPhrases, Pos(strPhrases, ',') - 1)
strPhrases = Mid(strPhrases, Pos(strPhrases, ',') + 1)