Sign in Join
FPDoc Onlineexperiment

NPos function

In unit StrUtils

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

Declaration

pascal
function NPos(const C: string; const S: string; N: Integer): SizeInt

Arguments

C

Substring to search for.

S

String to search.

N

Which position to return.

Description

NPos checks S for the position of the N-th occurrence of C. If C occurs less than N times in S, or does not occur in S at all, 0 is returned. If N is less than 1, zero is returned.

Errors

None.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.