[Overview][Resource strings][Constants][Types][Procedures and functions][Index] Reference for unit 'strutils' (#rtl)

PosEx

Search for the occurance of a character in a string, starting at a certain position.

Declaration

Source position: line 0

function PosEx(

  const SubStr: String;

  const S: String;

  Offset: Cardinal

):Integer;

function PosEx(

  const SubStr: String;

  const S: String

):Integer;

function PosEx(

  c: Char;

  const S: String;

  Offset: Cardinal

):Integer;

Arguments

SubStr

  

String to search for.

S

  

String to search.

Offset

  

Initial position where to start searching.

Function result

Position of the character, or 0 if it is not found.

Arguments

SubStr

  

String to search for.

S

  

String to search.

Function result

Position of the character, or 0 if it is not found.

Arguments

c

  

Character to search for.

S

  

String to search.

Offset

  

Initial position where to start searching.

Function result

Position of the character, or 0 if it is not found.

Description

PosEx returns the position of the first occurrence of the character C or the substring SubStr in the string S, starting the search at position Offset (default 1). If C or SubStr does not occur in S after the given Offset, zero is returned. The position Offset is also searched.

Errors

None.

See also

NPos

  

Returns the position of the N-th occurence of a substring in a string.

AnsiContainsText

  

Check whether a string contains a certain substring, ignoring case.

AnsiContainsStr

  

Checks whether a string contains a given substring

The latest version of this document can be found at lazarus-ccr.sourceforge.net.