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;
    
  • 相关阅读:
    PHP 的 序列化与反序列化 自己的理解
    通达OA 11.6 rce漏洞复现
    MySQL 表字段唯一性约束设置方法unique
    HTTP响应状态码
    PHP 魔术变量
    PHP匿名函数使用技巧
    PHP 三大结构
    PHP unset()函数销毁变量
    算法第五章作业
    算法第四章作业
  • 原文地址:https://www.cnblogs.com/GodPan/p/3700732.html
Copyright © 2011-2022 走看看