我对DELPHI写的几个基类型[2]

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 qiubolecn 的 blog

                                  awordseparator: string  //单据分隔符;
                                  ): string; //返回结果。
       //如 ' dbarcode asc, dname desc', 'dbarcode', '', ',', ' '的返回值为
            //' dname desc';

    class function deleterepeat(aoldstring: string;          //要处理字符
                                adeletestring: char;         //要删除的字符
                                arepeat: char): string;      //重复字符

    class function ifthen(aexpression: boolean; atrue: string; afalse: string): string;
                   //根据表达式的值,返回相应的字符串。
    class function absolutetorelate(aabsolute: string; acurrent: string): string;
                   //给定两个文件,将绝对路径转换成相对路径。
    class function relatetoabsolute(arelate: string; acurrent: string): string;
    class function similarposition(aone, atwo: string): integer;

    class function getcharnum(astring: string; achar: char): integer;

    class function indexof(astring, asubstring: string): integer;

    class function zerotoint(astring: string): integer;
    class function zerotofloat(astring: string): double;

    class function zerotostr(astring: string): string;

    class function sametext(astring, astring1: string): boolean;

    class function reverse(astring: string): string;

    class function isvalidip(const s: string): boolean;

    class function fillstring(achar: char; alength: integer): string;

    class function stuffstring(const atext: string; astart, alength: cardinal;
       const asubtext: string): string;

    class function getnextstring(var sourcestring: string; asplitchar: string): string;
  end;

  //整型类。
  tinteger = class
    class function inttostr(ainteger: integer): string; overload;
    class function inttostr(ainteger: int64): string; overload;

    class function isvalidint(astring: string): boolean;
    class function isvalidint64(astring: string): boolean;

    class function maxint: integer;
    class function maxlongint: integer;
    class function hashcode(ainteger: integer): integer;

    class function inttobin(ainteger: cardinal): string;
    class function inttohex(ainteger: integer): string;

    class function hextoint(astring: string): integer;
    class function makeserialno(ainteger: integer; adigit: integer): string;
  end;

  tfloat = class
    class function isvalidfloat(astring: string): boolean;
    class function maxdouble: double;
    class function mindouble: double;
    class function maxextended: extended;
    class function minextended: extended;

    class function samevalue(const a, b: single; epsilon: single = 0): boolean; overload;
    class function samevalue(const a, b: double; epsilon: double = 0): boolean; overload;
    class function samevalue(const a, b: extended; epsilon: extended = 0): boolean; overload;

    class function floattomoney(const value: double; round: boolean = true): string;
  end;

  tboolean = class
    class function booltostr(aboolean: boolean): string;
    class function strtobool(astring: string): boolean;  //如果不为'true'则为false;
  end;
implementation

{ tstring }

本文关键:我对DELPHI写的几个基类型
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top