MyChat Scripts Engine: IsStNumbers
Function to determine if a text string consists of numbers only (without any other symbols).
Syntax
function IsStNumbers(st: string): boolean;
Parameters and return values
Parameter |
Type |
Value |
st |
string |
source string. |
Function result
Returns true, if all string symbols are numbers from 0 to 9.
Example
const
sOnlyNumbers = '3495760054';
sString = ' -784521az';
procedure TestString(s: string);
begin
if IsStNumbers(s) then mLogScript('string "' + s + '" - number', '')
else mLogScript('string "' + s + '" - not number', '');
end;
begin
TestString(sString);
TestString(sOnlyNumbers);
end.
Script work result
[19:42:39] (Log "IsStNumbers"): string " -784521az" - not number
[19:42:39] (Log "IsStNumbers"): string "3495760054" - number
[19:42:39] (Run "IsStNumbers"): Script operation time: 3 ms
[19:42:39] (Run "IsStNumbers"): Script done successfully.