From RAD Studio API Documentation
Jump to: navigation, search


function StrToInt(const S: string): Integer;


extern DELPHI_PACKAGE int __fastcall StrToInt(const System::UnicodeString S)/* overload */;


Type Visibility Source Unit Parent
function public
System.SysUtils System.SysUtils


Converts a string that represents an integer (decimal or hex notation) into a number.

StrToInt converts the string S, which represents an integer-type number in either decimal or hexadecimal notation, into a number.

S must be an integer number, in either decimal or hexadecimal (see below) notation, with an optional sign ("-" or "+") at the beginning. Decimal or thousand separators are not supported. If S does not represent a valid number, StrToInt raises an EConvertError exception.

StrToInt supports strings in the following hexadecimal notations:

  • Delphi: $1234
  • C++: 0x1234
Note: In Delphi, you can also use the C++ hexadecimal values notation, and use prefixes 0x or x indistinctly.

See Also

Code Examples