Pos

Description:
Find the starting position of a Search string within the Source string.

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:
Use this function to find where in the Source string, the Search string starts. The search is Case Sensitive. If the Start parameter is not used then the search begins with the first character of the Source string. Zero (0) is returned if the Search string is not found.

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:
Find the first phrase in a comma delimited list and remove the first phrase from the original list.

String strPhrases
String strResult

strPhrases = 'Super Widgets, Long Widgets, Soft Widgets'
strResult = Left(strPhrases, Pos(strPhrases, ',') - 1)
strPhrases = Mid(strPhrases, Pos(strPhrases, ',') + 1)

Hosted by www.Geocities.ws

1