Delphi 转换大小写字符(UpperCase、LowerCase)
作者:互联网
Delphi 转换大小写字符(UpperCase、LowerCase)
1、UpperCase //转换成大写
function UpperCase(const S: string): string; var Ch: Char; L: Integer; Source, Dest: PChar; begin L := Length(S); SetLength(Result, L); Source := Pointer(S); Dest := Pointer(Result); while L <> 0 do begin Ch := Source^; if (Ch >= 'a') and (Ch <= 'z') then Dec(Ch, 32); Dest^ := Ch; Inc(Source); Inc(Dest); Dec(L); end; end;
2、LowerCase //转换成小写
function LowerCase(const S: string): string; var Ch: Char; L: Integer; Source, Dest: PChar; begin L := Length(S); SetLength(Result, L); Source := Pointer(S); Dest := Pointer(Result); while L <> 0 do begin Ch := Source^; if (Ch >= 'A') and (Ch <= 'Z') then Inc(Ch, 32); Dest^ := Ch; Inc(Source); Inc(Dest); Dec(L); end; end;
创建时间:2021.02.03 更新时间:
标签:LowerCase,Ch,Dest,UpperCase,Delphi,begin,Source 来源: https://www.cnblogs.com/guorongtao/p/14366623.html