//用慣Java或C#的人可能對Delphi非常生氣,連基本的類型都沒有,我平時工作中,經常會曾試著把一些函數集合在一起,也經常做一些屬於自己的基礎類型的函數,此處把它們弄出來,有不當之處,請大家點評.
unit BaseClass;
interface
uses
SysUtils, Classes, StrUtils, IdGlobal, Math;
type
TCharSet = set of char;
var
TNormalCharSet: TCharSet = [#13, #10, #32, '.', ',', ';'];
type
TString = class
private
FText: string;
public
function CharAt(APosition: Integer): Char;
//指定位置的字母
function toLowerCase: string; overload;
class function toLowerCase(AString: string): string; overload;
//小寫
function toUpperCase: string; overload;
class function toUpperCase(AString: string): string; overload;
//大寫
class function ValueOf(AValue: string): Boolean; overload;
class function ValueOf(AValue: Boolean): string; overload;
class function StringIn(AValue: string; AValues: array of string): Boolean;
class function Left(AValue: string; ALength: Integer): string;
class function Right(AValue: string; ALength: Integer): string;
class function DeletePrefix(AValue: string; FixedString: TCharSet = [#32]): string; //刪除前綴
class function DeleteSuffix(AValue: string; FixedString: TCharSet = [#32]): string; //刪除後綴
//
class function CompareString(AValue1: string; AValue2: string): Boolean;
class function HashCode(AValue: string): Integer;
class function LastChar(AValue: string): Char;
class function StringReplace(const S, OldPattern, NewPattern: string;
Flags: TReplaceFlags): string;
class function StringOfChar(Ch: Char; Count: Integer): string;
class function SetString(var s: string; buffer: PChar; len: Integer): string;
class function GetPy(AStr: string): string;
//得到對應的拼音.
class function IsAllChinese(AStr: string): Boolean;
class function IsAllEnglish(AStr: string): Boolean;
class function GetFirstWord(AValue: string; var A
[1] [2] [3] [4] [5] [6] [7] [8] [9] [10] ... 下一頁 >>