5,388
社区成员
发帖
与我相关
我的任务
分享
var
ls_Text: string;
i, j: integer;
lc_Char: Char;
begin
ls_Text := 'DACB';
for i := length(ls_Text) - 1 downto 1 do
begin
for j := 1 to i do
begin
if Ord(ls_Text[j]) > Ord(ls_Text[j + 1]) then
begin
lc_Char := ls_Text[j];
ls_Text[j] := ls_Text[j + 1];
ls_Text[j + 1] := lc_Char;
end;
end;
end;
ShowMessage(ls_Text);
end;