18.01.2012, 19:17
|
Так проходящий
|
|
Регистрация: 18.07.2011
Сообщения: 805
Версия Delphi: 7Lite
Репутация: 6063
|
|
PHP код:
function swap(s: string): string;
begin
case length(s) of
1: result := s;
2: result := s[2]+s[1];
else
result := s[length(s)] + swap(copy(s, 2, length(s)-2)) + s[1];
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Edit1.Text := swap(Edit1.text);
end;
|