System.SysUtils.StrToIntDef

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function StrToIntDef(const S: string; Default: Integer): Integer;

C++

extern DELPHI_PACKAGE int __fastcall StrToIntDef(const System::UnicodeString S, int Default)/* overload */;

Properties

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

Description

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

StrToIntDef converts the string S, which represents an integer-type number in either decimal or hexadecimal notation, into a number. If S does not represent a valid number, StrToIntDef returns Default.

StrToIntDef supports strings in the following hexadecimal notations:

  • Delphi: 0$1234 and 0x1234.
  • 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