如何将字符串中的半角字符转换为全角字符
//来自大富翁:http://search.delphibbs.com/displ.aspx?lid=3877333
/// 半角转全角的函数
function ToSDB(AInput: Widestring): WideString;
var
I: Integer;
nChar: Cardinal;
begin
Result := AInput;
for I := 1 to Length(AInput) do
begin
nChar := Cardinal(WideChar(AInput[I]));
if nChar = 32 then
begin
Result[I] := WideChar(12288);
Continue;
end;
if (nChar < 127) then
Result[I] := WideChar(nChar + 65248)
end;
end;
/// 全角转半角的函数
function ToDBC(const AInput: Widestring): Widestring;
var
I: Integer;
nChar: Cardinal;
begin
Result := AInput;
for I := 1 to Length(AInput) do
begin
nChar := Cardinal(WideChar(AInput[I]));
if nChar = 12288 then
begin
Result[I] := WideChar(32);
Continue;
end;
if (nChar > 65280) and (nChar < 65375) then
Result[I] := WideChar(nChar - 65248)
end;
end;