Data update
This commit is contained in:
parent
81fd053722
commit
52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions
16
Task/Reverse-a-string/Delphi/reverse-a-string-3.pas
Normal file
16
Task/Reverse-a-string/Delphi/reverse-a-string-3.pas
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
function Reverse(const s: string): string;
|
||||
var
|
||||
i, aLength, ahalfLength: Integer;
|
||||
c: Char;
|
||||
begin
|
||||
Result := s;
|
||||
aLength := Length(s);
|
||||
ahalfLength := aLength div 2;
|
||||
if aLength > 1 then
|
||||
for i := 1 to ahalfLength do
|
||||
begin
|
||||
c := result[i];
|
||||
result[i] := result[aLength - i + 1];
|
||||
result[aLength - i + 1] := c;
|
||||
end;
|
||||
end;
|
||||
Loading…
Add table
Add a link
Reference in a new issue