pos()

Function group Execute on client Platform(s)
String YES All

Syntax

pos(substring,string)

Description

Returns the position of substring in string, or zero if substring is not contained in string.

The substring must be contained within string in its entirety for the returned value to be non-zero. Also, the comparison is case sensitive and only the first occurrence of substring is returned (see third example).

Example

Calculate lResult as  pos('Mouse','Mickey Mouse')
# returns 8

Calculate lResult as pos('mouse','Mickey Mouse')
# return 0, note case

Calculate lResult as pos(' ','R S W Smith')
# returns 2, that is the position of the first space character

# you can strip the extension from a filename using mid() and pos() combined
If pos('.',lFileName## if lFileName contains a dot
  Calculate lFileName as mid(lFileName,1,pos('.',lFileName)-1)
End If