Searches for a specific character in a constant string SysUtils unit
 function StrScan ( const Characters : PAnsiChar; SearchChar : Char ) : PAnsiChar;
StrScan is used when you need to check a single character against a list of known characters (Characters).
If the SearchChar exists in Characters, then a pointer to the position in Characters is returned.
If it does not exist, a nil pointer is returned.
Related commands
AnsiPos Find the position of one string in another
AnsiIndexStr Compares a string with a list of strings - returns match index
AnsiMatchStr Returns true if a string exactly matches one of a list of strings
LastDelimiter Find the last position of selected characters in a string
 Author links

 Download this web site as a Windows program.

Example code : A simple example
  Numbers = '0123456789';
  if StrScan(Numbers, '2') <> nil
  then ShowMessage('2 is a numeric digit')
  else ShowMessage('2 is not a numeric digit');

  if StrScan(Numbers, 'A') <> nil
  then ShowMessage('A is a numeric digit')
  else ShowMessage('A is not a numeric digit');
Show full unit code
   2 is a numeric digit
   A is not a numeric digit
Delphi Programming Neil Moffatt 2002 - 2020. All rights reserved.  |  Home Page