Please enable JavaScript to view this site.

 

int = PosNth(nNth,sSubString,sString)

 

This macro function is similar to Pos, but it returns the nNth occurrence of a sub-string sSubString in the string sString.

 

If the sub-string is present, or is present less than nNth times, then the function returns zero.

PosNth(2,'A','Aardvark') = 0
PosNth(2,'a','Aardvark') = 6 
PosNth(1,'a','Art') = Pos('a','Art') = 0

Although PosNth(1,sOne,sTwo) is the same as Pos(sOne,sTwo), the former is slower to execute. Always use Pos instead of PosNth if you can.

 

See also: Pos.

 

 

 


Topic 108274, last updated on 18-Apr-2020