Unit 'sysutils' Package
[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] [#rtl]

StrScan

Find first occurrence of a character in a null-terminated string.

Declaration

Source position: syspchh.inc line 30

function StrScan(

  p: PAnsiChar;

  c: AnsiChar

):PAnsiChar; overload;

function StrScan(

  P: PWideChar;

  C: WideChar

):PWideChar; overload;

Description

Returns a pointer to the first occurrence of the character C in the null-terminated string P. If C does not occur, returns Nil.

Errors

None.

See also

StrRScan

  

Find last occurrence of a character in a null-terminated string.

StrPos

  

Find position of one null-terminated substring in another.

Example

Program Example13;

Uses strings;

{ Program to demonstrate the StrScan and StrRScan functions. }

Const P : PChar = 'This is a PCHAR string.';
      S : Char = 's' ;

begin
  Writeln ('P, starting from first ''s'' : ',StrScan(P,s));
  Writeln ('P, starting from last ''s'' : ',StrRScan(P,s));
end.

Documentation generated on: Dec 21 2024