Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
7
Task/Reverse-a-string/Delphi/reverse-a-string-1.delphi
Normal file
7
Task/Reverse-a-string/Delphi/reverse-a-string-1.delphi
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
function ReverseString(const InString: string): string;
|
||||
var
|
||||
i: integer;
|
||||
begin
|
||||
for i := Length(InString) downto 1 do
|
||||
Result := Result + InString[i];
|
||||
end;
|
||||
1
Task/Reverse-a-string/Delphi/reverse-a-string-2.delphi
Normal file
1
Task/Reverse-a-string/Delphi/reverse-a-string-2.delphi
Normal file
|
|
@ -0,0 +1 @@
|
|||
StrUtils.ReverseString
|
||||
16
Task/Reverse-a-string/Delphi/reverse-a-string-3.delphi
Normal file
16
Task/Reverse-a-string/Delphi/reverse-a-string-3.delphi
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