7月 102016
 

  Java、Php等语言中都有成熟的框架来解析Json数据,可以让我们使用很少的代码就把格式化好的json数据转换成程序可识别的对象或者属性,同时delphi中也有这样的组件来实现此功能,即IsuperObject。如果还没有这个组件的请在网上搜索下载或者在下面留言处留下你的邮箱向本人索取。

  下面先说一下ISuperObject中几个常用的函数

  • function SO(const s: SOString = ‘{}’): ISuperObject; overload; 此函数传入json数据字符串,并返回一个ISuperObject对象,这一般是我们解析json时使用的第一个函数,如jObj := SO(jsonstr)。
  • property O[const path: SOString]: ISuperObject read GetO write PutO; default; 如:jobj.O[‘username’],此函数被一个ISuperObject对象调用,方括号内的字符串为json中的字段名称,返回一个ISuperObject对象。
  • property S[const path: SOString]: SOString read GetS write PutS; 此函数被一个ISuperObject对象调用,和O[‘username’]不同的是,它返回的是一个SoString,即一个字符串,使用方法 str := jObj.S[‘username’]; 同理的还有其他几个类似的函数,如I[‘age’]返回整数,B[‘isenable’]返回布尔型,A[‘users’]返回一个TSuperArray数组
  • AsString, AsBoolean, AsInteger,AsArray,ISuperObject的函数,用来把ISuperObject转换成相应的数据类型。

  下面我们看一个演示代码,json数据如下

  Delphi版本2010,代码如下:

点击下载源代码

7月 122014
 

在PAYPAL帐户中添加自己的香港招行“香港一卡通”,需要填写以下信息:

(1)Name on account(帐户名称):收款人名字,英文、中文?

(2) Bank Name(银行名称):填写“CHINA MERCHANTS BANK HONG KONG BRANCH”;

(3) Account Type(帐户类型):选择“Checking(支票收款)”;

(4) Bank Code(银行代码):238,又叫CHATS CODE;

(5) Branch Location(分行地址):21F,12 HARCOURT ROAD CENTRAL

(6) Branch Code(分行代码):填写“860”这三位固定代码(即卡号中间的那三位);

(7) Account Number(帐户号码):填写你自己卡号的最后7位数字(即860之后的7位);

(7) Re-Enter Account Number(重复帐户号码):再次输入上面输入的7位收款帐号。

附截图:

paypal添加招商银行香港一卡通

其他信息:

1、招商銀行香港分行SWIFT CODE: CMBCHKHH

2、招商银行卡BIN号

信用卡:431988、356889、439225、439226、439227、518710、518718、622575、622576、622578、479229、479228、552534、552587、622581、622582、622577、521302、628362、356890、370285、370287、370289
借记卡:8位卡、955550、622580、622588、622609、621286、468203、512425、410062、524011、621483、621485、621486、621299

10月 252013
 

Delphi version: Delphi2010

1. SysUtils

//检查当前系统版本,如果当前系统版本大于等于AMajor.AMinor则返回true
function CheckWin32Version(AMajor: Integer; AMinor: Integer = 0): Boolean;
//获取文件版本
function GetFileVersion(const AFileName: string): Cardinal;
//将字符串转换为大写
function UpperCase(const S: string): string; overload;
function UpperCase(const S: string; LocaleOptions: TLocaleOptions): string; overload;
//将字符串转换为小写
function LowerCase(const S: string): string; overload;
function LowerCase(const S: string; LocaleOptions: TLocaleOptions): string; overload;
//比较两个字符串s1和s2,大小写第三,如果s1<s2返回小于0的值,如果s1=s2返回0,如果s1>s2返回大于0的值
function CompareStr(const S1, S2: string): Integer; overload;
function CompareStr(const S1, S2: string; LocaleOptions: TLocaleOptions): Integer; overload;
//判断两个字符串是否相等,大小写敏感,相等返回true,不相等返回false
function SameStr(const S1, S2: string): Boolean; overload;
function SameStr(const S1, S2: string; LocaleOptions: TLocaleOptions): Boolean; overload;
//比较p1和p2所指向的指定长度的内存,相等返回true,不相等返回false
function CompareMem(P1, P2: Pointer; Length: Integer): Boolean; assembler;
//比较两个字符串s1和s2,大小写不敏感,所有小写字母被转换为大写字母,如果s1<s2返回小于0的值,如果s1=s2返回0,如果s1>s2返回大于0的值
function CompareText(const S1, S2: string): Integer; overload;
function CompareText(const S1, S2: string; LocaleOptions: TLocaleOptions): Integer; overload;

//比较s1和s2是否相等,大小写不敏感,如果相等返回true,不相等返回false

function SameText(const S1, S2: string): Boolean; overload;
function SameText(const S1, S2: string; LocaleOptions: TLocaleOptions): Boolean; overload;

//

function AnsiUpperCase(const S: string): string; overload;
function AnsiLowerCase(const S: string): string; overload;
function AnsiCompareStr(const S1, S2: string): Integer; overload;
function AnsiSameStr(const S1, S2: string): Boolean; inline; overload;
function AnsiCompareText(const S1, S2: string): Integer; overload;
function AnsiSameText(const S1, S2: string): Boolean; inline; overload;
function AnsiStrComp(S1, S2: PAnsiChar): Integer; inline; overload;
function AnsiStrComp(S1, S2: PWideChar): Integer; inline; overload;
function AnsiStrIComp(S1, S2: PAnsiChar): Integer; inline; overload;
function AnsiStrIComp(S1, S2: PWideChar): Integer; inline; overload;
function AnsiStrLComp(S1, S2: PAnsiChar; MaxLen: Cardinal): Integer; overload;
function AnsiStrLComp(S1, S2: PWideChar; MaxLen: Cardinal): Integer; inline; overload;
function AnsiStrLIComp(S1, S2: PAnsiChar; MaxLen: Cardinal): Integer; overload;
function AnsiStrLIComp(S1, S2: PWideChar; MaxLen: Cardinal): Integer; inline; overload;
function AnsiStrLower(Str: PAnsiChar): PAnsiChar; overload;
function AnsiStrLower(Str: PWideChar): PWideChar; inline; overload;
function AnsiStrUpper(Str: PAnsiChar): PAnsiChar; overload;
function AnsiStrUpper(Str: PWideChar): PWideChar; inline; overload;
function AnsiLastChar(const S: AnsiString): PAnsiChar; overload;
function AnsiLastChar(const S: UnicodeString): PWideChar; overload;
function AnsiStrLastChar(P: PAnsiChar): PAnsiChar; overload;
function AnsiStrLastChar(P: PWideChar): PWideChar; overload;
function WideUpperCase(const S: WideString): WideString;
function WideLowerCase(const S: WideString): WideString;
function WideCompareStr(const S1, S2: WideString): Integer;
function WideSameStr(const S1, S2: WideString): Boolean; inline;
function WideCompareText(const S1, S2: WideString): Integer;
function WideSameText(const S1, S2: WideString): Boolean; inline;

//去掉头尾空格的函数

function Trim(const S: string): string; overload;
function TrimLeft(const S: string): string; overload;
function TrimRight(const S: string): string; overload;

//在字符串S的头和尾加上单引号

function QuotedStr(const S: string): string; overload;

//在字符串S的头和尾加上Quote,例如AnsiQuotedStr(‘b’, ‘c’)=cbc

function AnsiQuotedStr(const S: string; Quote: Char): string; overload;

//

function AnsiExtractQuotedStr(var Src: PAnsiChar; Quote: AnsiChar): AnsiString; overload;
function AnsiExtractQuotedStr(var Src: PWidechar; Quote: WideChar): UnicodeString; overload;

//如果S以AQuote开始和结尾,则去掉开始和结尾的AQuote,如果不是返回原字符串

function AnsiDequotedStr(const S: string; AQuote: Char): string; overload;

//将字符串中的换行符格式为指定的格式

function AdjustLineBreaks(const S: string; Style: TTextLineBreakStyle =
{$IFDEF LINUX} tlbsLF {$ENDIF}
{$IFDEF MACOSX} tlbsLF {$ENDIF}
{$IFDEF MSWINDOWS} tlbsCRLF {$ENDIF}): string; overload;

//

function IsValidIdent(const Ident: string; AllowDots: Boolean = False): Boolean;

//将整数型转换为字符串类型

function IntToStr(Value: Integer): string; overload;
function IntToStr(Value: Int64): string; overload;

//将无符号整数转换为字符串

function UIntToStr(Value: Cardinal): string; overload;
function UIntToStr(Value: UInt64): string; overload;

//将一个整数转换为十六进制字符串,Digits为最少显示多少位字符

function IntToHex(Value: Integer; Digits: Integer): string; overload;
function IntToHex(Value: Int64; Digits: Integer): string; overload;

//将一个字符串转换为整数,StrToIntDef中如果S为非整数格式字符串则返回Default

function StrToInt(const S: string): Integer; overload;
function StrToIntDef(const S: string; Default: Integer): Integer; overload;
function TryStrToInt(const S: string; out Value: Integer): Boolean; overload;

//将字符串转换为int64类型整数

function StrToInt64(const S: string): Int64; overload;
function StrToInt64Def(const S: string; const Default: Int64): Int64; overload;
function TryStrToInt64(const S: string; out Value: Int64): Boolean; overload;

//字符串类型转换为布尔类型

function StrToBool(const S: string): Boolean; overload;
function StrToBoolDef(const S: string; const Default: Boolean): Boolean; overload;
function TryStrToBool(const S: string; out Value: Boolean): Boolean; overload;

//从可执行程序的资源文件中根据Ident标识加载字符串

function LoadStr(Ident: Integer): string;

//从资源文件中加载字符串,并进行格式化操作

function FmtLoadStr(Ident: Integer; const Args: array of const): string;

//

function FileOpen(const FileName: string; Mode: LongWord): Integer;
function FileCreate(const FileName: string): Integer; overload; inline;
function FileCreate(const FileName: string; Rights: Integer): Integer; overload; inline;
function FileCreate(const FileName: string; Mode: LongWord; Rights: Integer): Integer; overload;
function FileRead(Handle: Integer; var Buffer; Count: LongWord): Integer;
function FileWrite(Handle: Integer; const Buffer; Count: LongWord): Integer;
function FileSeek(Handle, Offset, Origin: Integer): Integer; overload;
function FileSeek(Handle: Integer; const Offset: Int64; Origin: Integer): Int64; overload;
procedure FileClose(Handle: Integer); inline;
function FileAge(const FileName: string): Integer; overload; deprecated;
function FileExists(const FileName: string): Boolean;
function DirectoryExists(const Directory: string): Boolean;
function ForceDirectories(Dir: string): Boolean;

//
function FindFirst(const Path: string; Attr: Integer;var F: TSearchRec): Integer;
function FindNext(var F: TSearchRec): Integer;
procedure FindClose(var F: TSearchRec);
function FileGetDate(Handle: Integer): Integer;
function FileSetDate(const FileName: string; Age: Integer): Integer; overload;
function FileSetDate(Handle: Integer; Age: Integer): Integer; overload; platform;
function FileGetAttr(const FileName: string): Integer; platform;
function FileSetAttr(const FileName: string; Attr: Integer): Integer; platform; 
function FileIsReadOnly(const FileName: string): Boolean; inline;
function FileSetReadOnly(const FileName: string; ReadOnly: Boolean): Boolean;
function DeleteFile(const FileName: string): Boolean; inline;
function RenameFile(const OldName, NewName: string): Boolean; inline;
{ IsAssembly returns a boolean value that indicates whether the specified file is a .NET assembly. }
function IsAssembly(const FileName: string): Boolean;
function ChangeFileExt(const FileName, Extension: string): string; overload;
function ChangeFilePath(const FileName, Path: string): string; overload;
function ExtractFilePath(const FileName: string): string; overload;
function ExtractFileDir(const FileName: string): string; overload;
function ExtractFileDrive(const FileName: string): string; overload;
function ExtractFileName(const FileName: string): string; overload;
//获取文件的扩展名
function ExtractFileExt(const FileName: string): string; overload;
//将相对路径表示的文件名转换成绝对路径表示的文件名
function ExpandFileName(const FileName: string): string; overload;
function ExpandFileNameCase(const FileName: string; out MatchFound: TFilenameCaseMatch): string; overload;
function ExpandUNCFileName(const FileName: string): string; overload;
function ExtractRelativePath(const BaseName, DestName: string): string; overload;
function ExtractShortPathName(const FileName: string): string; overload;
function FileSearch(const Name, DirList: string): string;
function DiskFree(Drive: Byte): Int64;
function DiskSize(Drive: Byte): Int64;

//

function FileDateToDateTime(FileDate: Integer): TDateTime;
function DateTimeToFileDate(DateTime: TDateTime): Integer;
function GetCurrentDir: string;
function SetCurrentDir(const Dir: string): Boolean;
function CreateDir(const Dir: string): Boolean;
function RemoveDir(const Dir: string): Boolean;
//
function StrLen(const Str: PAnsiChar): Cardinal; overload;
function StrLen(const Str: PWideChar): Cardinal; overload;
function StrEnd(const Str: PAnsiChar): PAnsiChar; overload;
function StrEnd(const Str: PWideChar): PWideChar; overload;
function StrMove(Dest: PAnsiChar; const Source: PAnsiChar; Count: Cardinal): PAnsiChar; overload;
function StrMove(Dest: PWideChar; const Source: PWideChar; Count: Cardinal): PWideChar; overload;
function StrCopy(Dest: PAnsiChar; const Source: PAnsiChar): PAnsiChar; overload;
function StrCopy(Dest: PWideChar; const Source: PWideChar): PWideChar; overload;
function StrECopy(Dest: PAnsiChar; const Source: PAnsiChar): PAnsiChar; overload;
function StrECopy(Dest: PWideChar; const Source: PWideChar): PWideChar; overload;
function StrLCopy(Dest: PAnsiChar; const Source: PAnsiChar; MaxLen: Cardinal): PAnsiChar; overload;
function StrLCopy(Dest: PWideChar; const Source: PWideChar; MaxLen: Cardinal): PWideChar; overload;
function StrPCopy(Dest: PAnsiChar; const Source: AnsiString): PAnsiChar; overload;
function StrPCopy(Dest: PWideChar; const Source: UnicodeString): PWideChar; overload;
function StrPLCopy(Dest: PAnsiChar; const Source: AnsiString;
MaxLen: Cardinal): PAnsiChar; overload;
function StrPLCopy(Dest: PWideChar; const Source: UnicodeString;
MaxLen: Cardinal): PWideChar; overload;
function StrCat(Dest: PAnsiChar; const Source: PAnsiChar): PAnsiChar; overload;
function StrCat(Dest: PWideChar; const Source: PWideChar): PWideChar; overload;
function StrLCat(Dest: PAnsiChar; const Source: PAnsiChar; MaxLen: Cardinal): PAnsiChar; overload;
function StrLCat(Dest: PWideChar; const Source: PWideChar; MaxLen: Cardinal): PWideChar; overload;
function StrComp(const Str1, Str2: PAnsiChar): Integer; overload;
function StrComp(const Str1, Str2: PWideChar): Integer; overload;
function StrIComp(const Str1, Str2: PAnsiChar): Integer; overload;
function StrIComp(const Str1, Str2: PWideChar): Integer; overload;
function StrLComp(const Str1, Str2: PAnsiChar; MaxLen: Cardinal): Integer; overload;
function StrLComp(const Str1, Str2: PWideChar; MaxLen: Cardinal): Integer; overload;
function StrLIComp(const Str1, Str2: PAnsiChar; MaxLen: Cardinal): Integer; overload;
function StrLIComp(const Str1, Str2: PWideChar; MaxLen: Cardinal): Integer; overload;
function StrScan(const Str: PAnsiChar; Chr: AnsiChar): PAnsiChar; overload;
function StrScan(const Str: PWideChar; Chr: WideChar): PWideChar; overload;
function StrRScan(const Str: PAnsiChar; Chr: AnsiChar): PAnsiChar; overload;
function StrRScan(const Str: PWideChar; Chr: WideChar): PWideChar; overload;
function TextPos(Str, SubStr: PAnsiChar): PAnsiChar; overload;
function TextPos(Str, SubStr: PWideChar): PWideChar; overload;
function StrPos(const Str1, Str2: PAnsiChar): PAnsiChar; overload;
function StrPos(const Str1, Str2: PWideChar): PWideChar; overload;
function StrUpper(Str: PAnsiChar): PAnsiChar; overload;
function StrUpper(Str: PWideChar): PWideChar; overload;
function StrLower(Str: PAnsiChar): PAnsiChar; overload;
function StrLower(Str: PWideChar): PWideChar; overload;
function StrPas(const Str: PAnsiChar): AnsiString; overload;
function StrPas(const Str: PWideChar): UnicodeString; overload;
function AnsiStrAlloc(Size: Cardinal): PAnsiChar;
function WideStrAlloc(Size: Cardinal): PWideChar;
function StrAlloc(Size: Cardinal): PChar;
function StrBufSize(const Str: PAnsiChar): Cardinal; overload;
function StrBufSize(const Str: PWideChar): Cardinal; overload;
function StrNew(const Str: PAnsiChar): PAnsiChar; overload;
function StrNew(const Str: PWideChar): PWideChar; overload;
procedure StrDispose(Str: PAnsiChar); overload;
procedure StrDispose(Str: PWideChar); overload;
//
function Format(const Format: string;
const Args: array of const): string; overload;
function Format(const Format: string; const Args: array of const;
const FormatSettings: TFormatSettings): string; overload;
procedure FmtStr(var Result: string; const Format: string;
const Args: array of const); overload;
procedure FmtStr(var Result: string; const Format: string;
const Args: array of const; const FormatSettings: TFormatSettings); overload;
function StrFmt(Buffer, Format: PAnsiChar;
const Args: array of const): PAnsiChar; overload;
function StrFmt(Buffer, Format: PAnsiChar; const Args: array of const;
const FormatSettings: TFormatSettings): PAnsiChar; overload;
function StrFmt(Buffer, Format: PWideChar;
const Args: array of const): PWideChar; overload;
function StrFmt(Buffer, Format: PWideChar; const Args: array of const;
const FormatSettings: TFormatSettings): PWideChar; overload;
function StrLFmt(Buffer: PAnsiChar; MaxBufLen: Cardinal; Format: PAnsiChar;
const Args: array of const): PAnsiChar; overload;
function StrLFmt(Buffer: PAnsiChar; MaxBufLen: Cardinal; Format: PAnsiChar;
const Args: array of const;
const FormatSettings: TFormatSettings): PAnsiChar; overload;
function StrLFmt(Buffer: PWideChar; MaxBufLen: Cardinal; Format: PWideChar;
const Args: array of const): PWideChar; overload;
function StrLFmt(Buffer: PWideChar; MaxBufLen: Cardinal; Format: PWideChar;
const Args: array of const;
const FormatSettings: TFormatSettings): PWideChar; overload;
function FormatBuf(var Buffer; BufLen: Cardinal; const Format;
FmtLen: Cardinal; const Args: array of const): Cardinal; overload;
function FormatBuf(var Buffer; BufLen: Cardinal; const Format;
FmtLen: Cardinal; const Args: array of const;
const FormatSettings: TFormatSettings): Cardinal; overload;
function FormatBuf(Buffer: PWideChar; BufLen: Cardinal; const Format;
FmtLen: Cardinal; const Args: array of const): Cardinal; overload;
function FormatBuf(var Buffer: UnicodeString; BufLen: Cardinal; const Format;
FmtLen: Cardinal; const Args: array of const): Cardinal; overload;
function FormatBuf(Buffer: PWideChar; BufLen: Cardinal; const Format;
FmtLen: Cardinal; const Args: array of const;
const FormatSettings: TFormatSettings): Cardinal; overload;
function FormatBuf(var Buffer: UnicodeString; BufLen: Cardinal; const Format;
FmtLen: Cardinal; const Args: array of const;
const FormatSettings: TFormatSettings): Cardinal; overload;
function WideFormat(const Format: WideString;
const Args: array of const): WideString; overload;
function WideFormat(const Format: WideString;
const Args: array of const;
const FormatSettings: TFormatSettings): WideString; overload;
procedure WideFmtStr(var Result: WideString; const Format: WideString;
const Args: array of const); overload;
procedure WideFmtStr(var Result: WideString; const Format: WideString;
const Args: array of const; const FormatSettings: TFormatSettings); overload;
function WideFormatBuf(var Buffer; BufLen: Cardinal; const Format;
FmtLen: Cardinal; const Args: array of const): Cardinal; overload;
function WideFormatBuf(var Buffer; BufLen: Cardinal; const Format;
FmtLen: Cardinal; const Args: array of const;
const FormatSettings: TFormatSettings): Cardinal; overload;
//
function FloatToStr(Value: Extended): string; overload;
function FloatToStr(Value: Extended;
const FormatSettings: TFormatSettings): string; overload;
function CurrToStr(Value: Currency): string; overload;
function CurrToStr(Value: Currency;
const FormatSettings: TFormatSettings): string; overload;
function FloatToCurr(const Value: Extended): Currency;
function TryFloatToCurr(const Value: Extended; out AResult: Currency): Boolean;
function FloatToStrF(Value: Extended; Format: TFloatFormat;
Precision, Digits: Integer): string; overload;
function FloatToStrF(Value: Extended; Format: TFloatFormat;
Precision, Digits: Integer;
const FormatSettings: TFormatSettings): string; overload;
function CurrToStrF(Value: Currency; Format: TFloatFormat;
Digits: Integer): string; overload;
function CurrToStrF(Value: Currency; Format: TFloatFormat;
Digits: Integer; const FormatSettings: TFormatSettings): string; overload;
function FloatToText(BufferArg: PAnsiChar; const Value; ValueType: TFloatValue;
Format: TFloatFormat; Precision, Digits: Integer): Integer; overload;
function FloatToText(BufferArg: PWideChar; const Value; ValueType: TFloatValue;
Format: TFloatFormat; Precision, Digits: Integer): Integer; overload;
function FloatToText(BufferArg: PAnsiChar; const Value; ValueType: TFloatValue;
Format: TFloatFormat; Precision, Digits: Integer;
const FormatSettings: TFormatSettings): Integer; overload;
function FloatToText(BufferArg: PWideChar; const Value; ValueType: TFloatValue;
Format: TFloatFormat; Precision, Digits: Integer;
const FormatSettings: TFormatSettings): Integer; overload;
function FormatFloat(const Format: string; Value: Extended): string; overload;
function FormatFloat(const Format: string; Value: Extended;
const FormatSettings: TFormatSettings): string; overload;
function FormatCurr(const Format: string; Value: Currency): string; overload;
function FormatCurr(const Format: string; Value: Currency;
const FormatSettings: TFormatSettings): string; overload;
function FloatToTextFmt(Buf: PAnsiChar; const Value; ValueType: TFloatValue;
Format: PAnsiChar): Integer; overload;
function FloatToTextFmt(Buf: PAnsiChar; const Value; ValueType: TFloatValue;
Format: PAnsiChar; const FormatSettings: TFormatSettings): Integer; overload;
function FloatToTextFmt(Buf: PWideChar; const Value; ValueType: TFloatValue;
Format: PWideChar): Integer; overload;
function FloatToTextFmt(Buf: PWideChar; const Value; ValueType: TFloatValue;
Format: PWideChar; const FormatSettings: TFormatSettings): Integer; overload;
function StrToFloat(const S: string): Extended; overload;
function StrToFloat(const S: string;
const FormatSettings: TFormatSettings): Extended; overload;
function StrToFloatDef(const S: string;
const Default: Extended): Extended; overload;
function StrToFloatDef(const S: string; const Default: Extended;
const FormatSettings: TFormatSettings): Extended; overload;
function TryStrToFloat(const S: string; out Value: Extended): Boolean; overload;
function TryStrToFloat(const S: string; out Value: Extended;
const FormatSettings: TFormatSettings): Boolean; overload;
function TryStrToFloat(const S: string; out Value: Double): Boolean; overload;
function TryStrToFloat(const S: string; out Value: Double;
const FormatSettings: TFormatSettings): Boolean; overload;
function TryStrToFloat(const S: string; out Value: Single): Boolean; overload;
function TryStrToFloat(const S: string; out Value: Single;
const FormatSettings: TFormatSettings): Boolean; overload;
function StrToCurr(const S: string): Currency; overload;
function StrToCurr(const S: string;
const FormatSettings: TFormatSettings): Currency; overload;
function StrToCurrDef(const S: string;
const Default: Currency): Currency; overload;
function StrToCurrDef(const S: string; const Default: Currency;
const FormatSettings: TFormatSettings): Currency; overload;
function TryStrToCurr(const S: string; out Value: Currency): Boolean; overload;
function TryStrToCurr(const S: string; out Value: Currency;
const FormatSettings: TFormatSettings): Boolean; overload;
function TextToFloat(Buffer: PAnsiChar; var Value;
ValueType: TFloatValue): Boolean; overload;
function TextToFloat(Buffer: PAnsiChar; var Value; ValueType: TFloatValue;
const FormatSettings: TFormatSettings): Boolean; overload;
function TextToFloat(Buffer: PWideChar; var Value;
ValueType: TFloatValue): Boolean; overload;
function TextToFloat(Buffer: PWideChar; var Value; ValueType: TFloatValue;
const FormatSettings: TFormatSettings): Boolean; overload;
function HashName(Name: PAnsiChar): Cardinal;
procedure FloatToDecimal(var Result: TFloatRec; const Value;
ValueType: TFloatValue; Precision, Decimals: Integer);
//
function DateTimeToTimeStamp(DateTime: TDateTime): TTimeStamp;
function TimeStampToDateTime(const TimeStamp: TTimeStamp): TDateTime;
function MSecsToTimeStamp(MSecs: Comp): TTimeStamp;
function TimeStampToMSecs(const TimeStamp: TTimeStamp): Comp;
function EncodeDate(Year, Month, Day: Word): TDateTime;
function EncodeTime(Hour, Min, Sec, MSec: Word): TDateTime;
function TryEncodeDate(Year, Month, Day: Word; out Date: TDateTime): Boolean;
function TryEncodeTime(Hour, Min, Sec, MSec: Word; out Time: TDateTime): Boolean;
procedure DecodeDate(const DateTime: TDateTime; var Year, Month, Day: Word);
function DecodeDateFully(const DateTime: TDateTime; var Year, Month, Day,
DOW: Word): Boolean;
procedure DecodeTime(const DateTime: TDateTime; var Hour, Min, Sec, MSec: Word);
procedure DateTimeToSystemTime(const DateTime: TDateTime; var SystemTime: TSystemTime);
function SystemTimeToDateTime(const SystemTime: TSystemTime): TDateTime;
function DayOfWeek(const DateTime: TDateTime): Word;
function Date: TDateTime;
function Time: TDateTime;
function GetTime: TDateTime;
function Now: TDateTime;
function CurrentYear: Word;
function IncMonth(const DateTime: TDateTime; NumberOfMonths: Integer = 1): TDateTime;
procedure IncAMonth(var Year, Month, Day: Word; NumberOfMonths: Integer = 1);
procedure ReplaceTime(var DateTime: TDateTime; const NewTime: TDateTime);
procedure ReplaceDate(var DateTime: TDateTime; const NewDate: TDateTime);
function IsLeapYear(Year: Word): Boolean;
function DateToStr(const DateTime: TDateTime): string; overload; inline;
function DateToStr(const DateTime: TDateTime;
const FormatSettings: TFormatSettings): string; overload; inline;
function TimeToStr(const DateTime: TDateTime): string; overload; inline;
function TimeToStr(const DateTime: TDateTime;
const FormatSettings: TFormatSettings): string; overload; inline;
function DateTimeToStr(const DateTime: TDateTime): string; overload; inline;
function DateTimeToStr(const DateTime: TDateTime;
const FormatSettings: TFormatSettings): string; overload; inline;
function StrToDate(const S: string): TDateTime; overload;
function StrToDate(const S: string;
const FormatSettings: TFormatSettings): TDateTime; overload;
function StrToDateDef(const S: string;
const Default: TDateTime): TDateTime; overload;
function StrToDateDef(const S: string; const Default: TDateTime;
const FormatSettings: TFormatSettings): TDateTime; overload;
function TryStrToDate(const S: string; out Value: TDateTime): Boolean; overload;
function TryStrToDate(const S: string; out Value: TDateTime;
const FormatSettings: TFormatSettings): Boolean; overload;
function StrToTime(const S: string): TDateTime; overload;
function StrToTime(const S: string;
const FormatSettings: TFormatSettings): TDateTime; overload;
function StrToTimeDef(const S: string;
const Default: TDateTime): TDateTime; overload;
function StrToTimeDef(const S: string; const Default: TDateTime;
const FormatSettings: TFormatSettings): TDateTime; overload;
function TryStrToTime(const S: string; out Value: TDateTime): Boolean; overload;
function TryStrToTime(const S: string; out Value: TDateTime;
const FormatSettings: TFormatSettings): Boolean; overload;
function StrToDateTime(const S: string): TDateTime; overload;
function StrToDateTime(const S: string;
const FormatSettings: TFormatSettings): TDateTime; overload;
function StrToDateTimeDef(const S: string;
const Default: TDateTime): TDateTime; overload;
function StrToDateTimeDef(const S: string; const Default: TDateTime;
const FormatSettings: TFormatSettings): TDateTime; overload;
function TryStrToDateTime(const S: string;
out Value: TDateTime): Boolean; overload;
function TryStrToDateTime(const S: string; out Value: TDateTime;
const FormatSettings: TFormatSettings): Boolean; overload;
function FormatDateTime(const Format: string;
DateTime: TDateTime): string; overload; inline;
function FormatDateTime(const Format: string; DateTime: TDateTime;
const FormatSettings: TFormatSettings): string; overload;
procedure DateTimeToString(var Result: string; const Format: string;
DateTime: TDateTime); overload;
procedure DateTimeToString(var Result: string; const Format: string;
DateTime: TDateTime; const FormatSettings: TFormatSettings); overload;
function FloatToDateTime(const Value: Extended): TDateTime;
function TryFloatToDateTime(const Value: Extended; out AResult: TDateTime): Boolean;
//
function SysErrorMessage(ErrorCode: Cardinal): string;
function GetLocaleStr(Locale, LocaleType: Integer; const Default: string): string; platform;
function GetLocaleChar(Locale, LocaleType: Integer; Default: Char): Char; platform;
procedure GetFormatSettings;
procedure GetLocaleFormatSettings(LCID: Integer;
var FormatSettings: TFormatSettings);
//
function GetModuleName(Module: HMODULE): string;
function ExceptionErrorMessage(ExceptObject: TObject; ExceptAddr: Pointer;
Buffer: PChar; Size: Integer): Integer;
procedure ShowException(ExceptObject: TObject; ExceptAddr: Pointer);
procedure Abort;
procedure OutOfMemoryError;
procedure Beep; inline;
// MBCS functions
function ByteType(const S: AnsiString; Index: Integer): TMbcsByteType; overload;
function ByteType(const S: UnicodeString; Index: Integer): TMbcsByteType; overload;
function StrByteType(Str: PAnsiChar; Index: Cardinal): TMbcsByteType; overload;
function StrByteType(Str: PWideChar; Index: Cardinal): TMbcsByteType; overload;
function ByteToCharLen(const S: AnsiString; MaxLen: Integer): Integer; overload; inline;
function ByteToCharLen(const S: UnicodeString; MaxLen: Integer): Integer; overload; inline; deprecated ‘Use ElementToCharLen.’;
function ElementToCharLen(const S: AnsiString; MaxLen: Integer): Integer; overload;
function ElementToCharLen(const S: UnicodeString; MaxLen: Integer): Integer; overload;
function CharToByteLen(const S: AnsiString; MaxLen: Integer): Integer; overload; inline;
function CharToByteLen(const S: UnicodeString; MaxLen: Integer): Integer; overload; inline; deprecated ‘Use CharToElementLen.’;
function CharToElementLen(const S: AnsiString; MaxLen: Integer): Integer; overload;
function CharToElementLen(const S: UnicodeString; MaxLen: Integer): Integer; overload;
function ByteToCharIndex(const S: AnsiString; Index: Integer): Integer; overload; inline;
function ByteToCharIndex(const S: UnicodeString; Index: Integer): Integer; overload; inline; deprecated ‘Use ElementToCharIndex.’;
function ElementToCharIndex(const S: AnsiString; Index: Integer): Integer; overload;
function ElementToCharIndex(const S: UnicodeString; Index: Integer): Integer; overload;
function CharToByteIndex(const S: AnsiString; Index: Integer): Integer; overload; inline;
function CharToByteIndex(const S: UnicodeString; Index: Integer): Integer; overload; inline; deprecated ‘Use CharToElementIndex.’;
function CharToElementIndex(const S: AnsiString; Index: Integer): Integer; overload;
function CharToElementIndex(const S: UnicodeString; Index: Integer): Integer; overload;
function StrCharLength(const Str: PAnsiChar): Integer; overload;
function StrCharLength(const Str: PWideChar): Integer; overload;
function StrNextChar(const Str: PAnsiChar): PAnsiChar; inline; overload;
function StrNextChar(const Str: PWideChar): PWideChar; overload;
function CharLength(const S: AnsiString; Index: Integer): Integer; overload;
function CharLength(const S: UnicodeString; Index: Integer): Integer; overload;
function NextCharIndex(const S: UnicodeString; Index: Integer): Integer; overload;
function NextCharIndex(const S: AnsiString; Index: Integer): Integer; overload;
function IsLeadChar(C: AnsiChar): Boolean; overload; inline;
function IsLeadChar(C: WideChar): Boolean; overload; inline;
function CharInSet(C: AnsiChar; const CharSet: TSysCharSet): Boolean; overload; inline;
function CharInSet(C: WideChar; const CharSet: TSysCharSet): Boolean; overload; inline;
function IsPathDelimiter(const S: string; Index: Integer): Boolean; overload;
function IsDelimiter(const Delimiters, S: string; Index: Integer): Boolean; overload;
function IncludeTrailingPathDelimiter(const S: string): string; overload;
function IncludeTrailingBackslash(const S: string): string; platform; overload; inline;
function ExcludeTrailingPathDelimiter(const S: string): string; overload;
function ExcludeTrailingBackslash(const S: string): string; platform; overload; inline;
function LastDelimiter(const Delimiters, S: string): Integer; overload;
function FindDelimiter(const Delimiters, S: string; StartIdx: Integer = 1): Integer;
function AnsiCompareFileName(const S1, S2: string): Integer; inline; overload;
function SameFileName(const S1, S2: string): Boolean; inline; overload;
function AnsiLowerCaseFileName(const S: string): string; overload;
function AnsiUpperCaseFileName(const S: string): string; overload;
function AnsiPos(const Substr, S: string): Integer; overload;
function AnsiStrPos(Str, SubStr: PAnsiChar): PAnsiChar; overload;
function AnsiStrPos(Str, SubStr: PWideChar): PWideChar; overload;
function AnsiStrRScan(Str: PAnsiChar; Chr: AnsiChar): PAnsiChar; overload;
function AnsiStrRScan(Str: PWideChar; Chr: WideChar): PWideChar; inline; overload;
function AnsiStrScan(Str: PAnsiChar; Chr: AnsiChar): PAnsiChar; overload;
function AnsiStrScan(Str: PWideChar; Chr: WideChar): PWideChar; overload; inline;
function StringReplace(const S, OldPattern, NewPattern: string;
Flags: TReplaceFlags): string; overload;
function WrapText(const Line, BreakStr: string; const BreakChars: TSysCharSet;
MaxCol: Integer): string; overload;
function WrapText(const Line: string; MaxCol: Integer = 45): string; overload;
function FindCmdLineSwitch(const Switch: string; const Chars: TSysCharSet;
IgnoreCase: Boolean): Boolean; overload;
function FindCmdLineSwitch(const Switch: string): Boolean; overload;
function FindCmdLineSwitch(const Switch: string; IgnoreCase: Boolean): Boolean; overload;
procedure FreeAndNil(var Obj); inline;
// Interface support routines
function Supports(const Instance: IInterface; const IID: TGUID; out Intf): Boolean; overload;
function Supports(const Instance: TObject; const IID: TGUID; out Intf): Boolean; overload;
function Supports(const Instance: IInterface; const IID: TGUID): Boolean; overload;
function Supports(const Instance: TObject; const IID: TGUID): Boolean; overload;
function Supports(const AClass: TClass; const IID: TGUID): Boolean; overload;
function CreateGUID(out Guid: TGUID): HResult; stdcall;
function StringToGUID(const S: string): TGUID;
function GUIDToString(const GUID: TGUID): string;
function IsEqualGUID(const guid1, guid2: TGUID): Boolean; stdcall;
// Package support routines
function LoadPackage(const Name: string): HMODULE; overload;
function LoadPackage(const Name: string; AValidatePackage: TValidatePackageProc): HMODULE; overload;
procedure UnloadPackage(Module: HMODULE);
procedure GetPackageInfo(Module: HMODULE; Param: Pointer; var Flags: Integer;
InfoProc: TPackageInfoProc);
function GetPackageDescription(ModuleName: PChar): string;
procedure InitializePackage(Module: HMODULE); overload;
procedure InitializePackage(Module: HMODULE; AValidatePackage: TValidatePackageProc); overload;
procedure FinalizePackage(Module: HMODULE);
procedure RaiseLastOSError; overload;
procedure RaiseLastOSError(LastError: Integer); overload;
procedure RaiseLastWin32Error; deprecated ‘Use RaiseLastOSError’;
function Win32Check(RetVal: BOOL): BOOL; platform;
//Termination procedure support
procedure AddTerminateProc(TermProc: TTerminateProc);
function CallTerminateProcs: Boolean;
function GDAL: LongWord;
procedure RCS;
procedure RPR;

 Posted by on 2013-10-25
10月 072013
 

  刚才在开发的时候,突然不能改变工程的图标和版本等信息了,把dof文件删除掉也不起作用。后来想起来,原来在前几天把工程默认的引用的资源文件的代码去掉了{$R *.res},打开Project->View Source后,将{$R *.res}加到里面就可以了。如下所示:

Delphi版本:Delphi7

 Posted by on 2013-10-07
9月 172013
 

Delphi中读取Outlook的数据,代码如下:

 Form代码:

相关链接:
 Microsoft Outlook Constants
AppointmentItem Object Members
Items Members (Outlook)
Folders Property
Attachment Object Members
Application Object Members
ContactItem Object Members

4月 122013
 

1. 今天check out项目的时候,svn突然报了一个如下错误:

在网上查了一上解决办法为:

在地址和项目名称之间加上svn,本例中为如下:http://127.0.0.1/svn/financing,再进行check out就没问题了

SVN客户端:TortoiseSVN 1.7.11, Build 23600 – 64 Bit, Subversion 1.7.8

SVN服务端:VisualSVN Server Manager Version: 2.5.9

1月 122013
 

在Delphi的ListView中实现向上移动或者向下移动某行的功能,代码如下:

 

XML的NodeName的特殊值

 分类:Other 阅读 (1,110)  1 Response »
12月 242012
 

今天写一个用Java读取XML文件的代码的时候,突然在for循环里发现NodeName=#text的情况,翻来覆去的看XML并没有发现有NodeName为#text的节点。GG了一下才发现原来XML的NodeName并不只是按“<”右边的节点名来定义的,在W3C的文档中还定义了一些特殊的NodeName。

下面先看一下W3C文档中对NodeName的定义

Interface nodeName
Element The tag name, eg. HTML
Attr The attribute name, eg. id
Text #text
CDATASection #cdata-section
EntityReference The name of the entity reference, eg. amp
Entity The entity name, eg. &
ProcessingInstruction The target of the processing instruction, eg.xml-stylesheet
Comment #comment
Document #document
DocumentType The name of the document type, eg. html
DocumentFragment #document-fragment
Notation The notation name

本人今天使用的XML如下:

在两个<User..>的前面各有一个#text类型的Node,乍一看什么都没有啊?其实<UserList>和下行的<User…>之间是有一堆的空格的,于是这堆空格就被当成了#text类型。将XML改成如下样子后就没有那两个#text类型的Node了

现在也明白为什么有的地方会用如下的判断节点类型的代码了

 

 

 

 Posted by on 2012-12-24

Eclipse快捷键大全

 分类:Other 阅读 (1,110)  No Responses »
12月 192012
 

调试

F11 开始调试
Ctrl+F11 开始执行程序
Ctrl+Shift+B  创建/取消断点
F5  步进调试,如遇子函数进入子函数中调试
F6  步进调试,不进入子函数调试
F7  跳出本函数并定位到调用本函数的地方
F8  运行程序
Ctrl+F2  结束调试

编辑器

Ctrl+Shift+O 管理Import部分,将代码中需要引入但还没引入的单元添加到import头
Ctrl+D 删除本行代码
Ctrl+M 最大化面板窗口
F3 跳转代码到光标所在类的定义处
Alt+左方向键 回到上一次按F3的地方
Ctrl+Shift+1 添加书签(本人自定义)
Alt+Shift+S 打开Source菜单

Html特殊字符编码表

 分类:Other 阅读 (1,090)  No Responses »
10月 262012
 
1. HTML码都以&开始并以;结尾
2. 记住一些字符的英语全拼可以方便记住这些符号,比如:< lt 为less than, > gt 为greater than, 空格 nbsp为Non-breaking Space
字符 HTML码 十进制码 字符 HTML码 十进制码 字符 HTML码 十进制码
Α &Alpha; &#913; Β &Beta; &#914; Γ &Gamma; &#915;
Δ &Delta; &#916; Ε &Epsilon; &#917; Ζ &Zeta; &#918;
Η &Eta; &#919; Θ &Theta; &#920; Ι &Iota; &#921;
Κ &Kappa; &#922; Λ &Lambda; &#923; Μ &Mu; &#924;
Ν &Nu; &#925; Ξ &Xi; &#926; Ο &Omicron; &#927;
Π &Pi; &#928; Ρ &Rho; &#929; Σ &Sigma; &#931;
Τ &Tau; &#932; Υ &Upsilon; &#933; Φ &Phi; &#934;
Χ &Chi; &#935; Ψ &Psi; &#936; Ω &Omega; &#937;
α &alpha; &#945; β &beta; &#946; γ &gamma; &#947;
δ &delta; &#948; ε &epsilon; &#949; ζ &zeta; &#950;
η &eta; &#951; θ &theta; &#952; ι &iota; &#953;
κ &kappa; &#954; λ &lambda; &#955; μ &mu; &#956;
ν &nu; &#957; ξ &xi; &#958; ο &omicron; &#959;
π &pi; &#960; ρ &rho; &#961; ? &sigmaf; &#962;
σ &sigma; &#963; τ &tau; &#964; υ &upsilon; &#965;
φ &phi; &#966; χ &chi; &#967; ψ &psi; &#968;
ω &omega; &#969; ϑ &thetasym; &#977; ϒ &upsih; &#978;
ϖ &piv; &#982; &bull; &#8226; &hellip; &#8230;
&prime; &#8242; &Prime; &#8243; &oline; &#8254;
&frasl; &#8260; &weierp; &#8472; &image; &#8465;
&real; &#8476; &trade; &#8482; &alefsym; &#8501;
&larr; &#8592; &uarr; &#8593; &rarr; &#8594;
&darr; &#8595; &harr; &#8596; &crarr; &#8629;
&lArr; &#8656; &uArr; &#8657; &rArr; &#8658;
&dArr; &#8659; &hArr; &#8660; &forall; &#8704;
&part; &#8706; &exist; &#8707; &empty; &#8709;
&nabla; &#8711; &isin; &#8712; &notin; &#8713;
&ni; &#8715; &prod; &#8719; &sum; &#8722;
&minus; &#8722; &lowast; &#8727; &radic; &#8730;
&prop; &#8733; &infin; &#8734; &ang; &#8736;
&and; &#8869; &or; &#8870; &cap; &#8745;
&cup; &#8746; &int; &#8747; &there4; &#8756;
&sim; &#8764; &cong; &#8773; &asymp; &#8773;
&ne; &#8800; &equiv; &#8801; &le; &#8804;
&ge; &#8805; &sub; &#8834; &sup; &#8835;
&nsub; &#8836; &sube; &#8838; &supe; &#8839;
&oplus; &#8853; &otimes; &#8855; &perp; &#8869;
&sdot; &#8901; &lceil; &#8968; &rceil; &#8969;
&lfloor; &#8970; &rfloor; &#8971; &loz; &#9674;
&spades; &#9824; &clubs; &#9827; &hearts; &#9829;
&diams; &#9830; &nbsp; &#160; ¡ &iexcl; &#161;
&cent; &#162; &pound; &#163; ¤ &curren; &#164;
&yen; &#165; | &brvbar; &#166; § &sect; &#167;
¨ &uml; &#168; © &copy; &#169; a &ordf; &#170;
« &laquo; &#171; ¬ &not; &#172; &shy; &#173;
® &reg; &#174; ˉ &macr; &#175; ° &deg; &#176;
± &plusmn; &#177; 2 &sup2; &#178; 3 &sup3; &#179;
&acute; &#180; μ &micro; &#181 &quot; &#34;
< &lt; &#60; > &gt; &#62; &#39;
& &amp;