Home  |  Delphi .net Home  |  System.Char  |  IsSeparator Method
  
IsSeparator  
Method  
Returns true if a given character is a separator character
Char Structure
System NameSpace
CF1.  Function IsSeparator ( UnicodeChar : Char ) : Boolean; Static;
NotCF2.  Function IsSeparator ( CharString : String; Index : Integer ) : Boolean; Static;
CF : Methods with this mark are Compact Framework Compatible
Description
Returns true if the Unicode character, or the character at Index position in CharString is a separator character.
 
Examples of separator characters :
 
Blank
Line separator
Paragraph separator

 
However, the MSDN documentation does not make it clear what characters represent the latter two categories. Certainly, Tab (9), Line Feed (10), Carriage Return (13) are not seen as separator characters.
Notes
Very Important : Methods in .Net treat strings as starting at 0, unlike traditional Delphi where they started at 1.

Static methods are not methods of an object - they are simply class functions or procedures available at any time.
Microsoft MSDN Links
System
System.Char
 Author links

 Buy Website Traffic at
 Buywebsitetrafficexperts.com

 Buy Proxies at
 Buyproxies.io
 
 
 
An example of both syntaxes
program Project1;
{$APPTYPE CONSOLE}

var
  myStr  : String;
  i      : Integer;

begin
  if System.Char.IsSeparator(' ')
  then Console.WriteLine(''' '' is a separator character')
  else Console.WriteLine(''' '' is not a separator character');

  myStr := 'Hi - there';

  for i := 0 to Length(myStr)-1 do
    if System.Char.IsSeparator(myStr, i)  // Note 0 based index
    then Console.WriteLine('''' + myStr[i+1] + ''' is a separator character')
    else Console.WriteLine('''' + myStr[i+1] + ''' is not a separator character');

  Console.ReadLine;
end.
   ' ' is a separator character
   'H' is not a separator character
   'i' is not a separator character
   ' ' is a separator character
   '-' is not a separator character
   ' ' is a separator character
   't' is not a separator character
   'h' is not a separator character
   'e' is not a separator character
   'r' is not a separator character
   'e' is not a separator character
 
 
Delphi Programming Neil Moffatt 2002 - 2017. All rights reserved.  |  Contact the author