| Description |
Returns true if the Unicode character, or the character at Index position in CharString is a numeric digit character.
Examples of numeric characters according to the MSDN documentation :
| 0123456789 | Decimal digits |
| MCLXV | Roman numerals |
However IsNumber does not seem to recognise the roman numerals. None of the MSDN examples clarify this matter.
Do not use this if you are simply looking to parse a normal decimal string - use IsDigit.
|
| | 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
|
|
|
| An example of both syntaxes |
program Project1;
{$APPTYPE CONSOLE}
var
myStr : String;
begin
if System.Char.IsNumber('1')
then Console.WriteLine('1 is a number character')
else Console.WriteLine('1 is not a number character');
myStr := 'A2';
if System.Char.IsNumber(myStr, 0) // Note 0 based index
then Console.WriteLine('''' + myStr[1] + ''' is a number character')
else Console.WriteLine('''' + myStr[1] + ''' is not a number character');
if System.Char.IsNumber(myStr, 1) // Note 0 based index
then Console.WriteLine('''' + myStr[2] + ''' is a number character')
else Console.WriteLine('''' + myStr[2] + ''' is not a number character');
Console.ReadLine;
end.
| | Show full unit code | 1 is a number character
'A' is not a number character
'2' is a number character
|
| |
|
|
|