Author: Jonas Bilinkevicius
How to flip the characters in a string
Answer:
If you want to take "Hello" and make it "olleH" then use the following:
1 procedure Flip(A: string);
2 var3 t: Integer;
4 begin5 Result := '';
6 for t := Length(A) downto 1 do7 Result := Result + A[t];
8 end;
9 10 if you want to take "abcd" and make it "zyxw" then use the following:
11 12 procedure Flip(A: string);
13 var14 t: Integer;
15 begin16 Result := '';
17 A := Uppercase(A); {develop others for lower case}18 for t := 1 to Length(A) do19 Result := Result + CHR(91 - (ORD(A[t]) - 65));
20 end;