System.SysUtils.TryStrToUInt64

Aus RAD Studio API Documentation
Wechseln zu: Navigation, Suche

Delphi

function TryStrToUInt64(const S: string; out Value: UInt64): Boolean;

C++

extern DELPHI_PACKAGE bool __fastcall TryStrToUInt64(const System::UnicodeString S, /* out */ unsigned __int64 &Value)/* overload */;

Eigenschaften

Typ Sichtbarkeit Quelle Unit Übergeordnet
function public
System.SysUtils.pas
System.SysUtils.hpp
System.SysUtils System.SysUtils


Beschreibung

Konvertiert einen String, der einen Integerwert repräsentiert (in dezimaler oder hexadezimaler Notation), in eine Zahl.

TryStrToUInt64 konvertiert den String S, der einen Integerwert repräsentiert (in dezimaler oder hexadezimaler Notation), in eine Zahl und weist diese Value zu. Value wird als vorzeichenloser 64 Bit großer Integerwert dargestellt. Wenn S keine gültige Zahl repräsentiert, gibt TryStrToUInt64 False zurück; ansonsten gibt TryStrToUInt64 True zurück.

TryStrToUInt64 unterstützt Strings in den folgenden hexadezimalen Notationen:

  • Delphi: 0$1234 und 0x1234.
  • C++: 0x1234.

Um Dezimal-, aber keine Hexadezimalwerte im Eingabe-String zu akzeptieren, können Sie Quelltext wie den folgenden verwenden:

Delphi:
function TryDecimalStrToUInt64( const S: string; out Value: UInt64): Boolean;
begin
  result := (pos('$',S)=0) and ((pos('x',S)=0)) and TryStrToUInt64(S,Value);
end;
C++:
bool __fastcall TForm1::TryDecimalStrToUInt64(const System::UnicodeString S, unsigned __int64 &Value)
{
  bool result;
  result= (Pos('x',S)==0) && TryStrToUInt64(S,Value);
  return result;
}

Siehe auch