프로그래밍 언어/Delphi

[Reference] System.SysUtils.StrToInt

얗마 2017. 3. 25. 20:13

Delphi

function StrToInt(const S: string): Integer;

C++

extern PACKAGE int __fastcall StrToInt(const System::UnicodeString S)/* 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.

StrToInt 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, StrToInt raises an EConvertError exception.

 

정수 (10 진수 또는 16 진수)를 나타내는 문자열을 숫자로 변환합니다.

StrToInt 10 진수 또는 16 진수 표기법으로 정수 유형 숫자를 나타내는 문자열 S를 숫자로 변환합니다.

S가 유효한 숫자를 나타내지 않으면, StrToIntEConvertError exception을 발생시킵니다.

 

Example

var

  NumStr: string;

 

begin

  NumStr := '5';

 

  // 결과: 10

  Writeln(StrToInt(NumStr) + 5);

  Readln;

end.

 

출처: http://docwiki.embarcadero.com/Libraries/XE2/en/System.SysUtils.StrToInt