String.PosEx

Top  Previous  Next

 

Syntax

function String.PosEx(SubStr: string; Str: string; Offset: integer): integer

 

Alternative Names

ibec_PosEx

 

Description

Tries to locate the given string SubStr in the string Str, start the search at position Offset. This is case sensitive.

 

When found, this returns the character position at which the sub-string is found, starting at position 1. When not found, 0 is returned.

 

When Offset equals 1, the function is equivalent to calling String.Pos.

 

See also

String.Pos

 

Example

execute udsblock

as

begin

  strvalue = 'this is a test for String.pos';

  /* the first 'p' is found at position 27 */

  p = String.Pos('p', strvalue);

  

  /* 'x' is not found, 0 is returned */

  p = String.Pos('x', strvalue);

  

  /* skip the first 'a' by starting at position 2 */

  p = String.PosEx('a', 'abab', 2);

end