zoukankan      html  css  js  c++  java
  • Delphi XE6 TStringHelper中的string类型转换

    类型转换:


    function ToBoolean: Boolean;
    function ToInteger: Integer;
    function ToSingle: Single;
    function ToDouble: Double;
    function ToExtended: Extended;
    
    class function ToBoolean(const S: string): Boolean;
    class function ToInteger(const S: string): Integer;
    class function ToSingle(const S: string): Single;
    class function ToDouble(const S: string): Double;
    class function ToExtended(const S: string): Extended;
    
    class function Parse(const Value: Integer): string;
    class function Parse(const Value: Int64): string;
    class function Parse(const Value: Boolean): string;
    class function Parse(const Value: Extended): string;
    //--------------------------------------------------------------------------------
    var
      S: string;
      str: string;
      n: Integer;
      b: Boolean;
      f: Double;
    begin
      str := S.Parse(123);
      n := str.ToInteger;  // 123
      b := str.ToBoolean;  // True
    
      str := S.Parse(True);
      b := str.ToBoolean;  // True
      n := str.ToInteger;  // -1
    
      str := S.Parse(3.14159260000);
      f := str.ToDouble;  //3.1415926
    end;
    
  • 相关阅读:
    JVM
    关于filter
    session
    xml
    互联网应用和企业级项目的区别
    本学期javaee目标
    团队项目软件度量
    团队项目总结
    团队项目来换网最新
    ubuntu18.04 编译opencv4.4.0 带cuda加速,ffmpeg
  • 原文地址:https://www.cnblogs.com/GodPan/p/3700732.html
Copyright © 2011-2022 走看看