Author Topic: Text Flipper  (Read 2256 times)

0 Members and 1 Guest are viewing this topic.

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Text Flipper
« on: June 26, 2007, 10:35:55 am »
Script Name: Text Flipper
Script Description: Flips the string (so left becomes right) between two specified locations within a string
Original Author: Curt (DorkeyDear)
Core Version: 2.6.1b
Code:
Code: [Select]
function Flip(Text: string; First, Last: integer): string;
var
  i: integer;
  Build: string;
begin
  for i := Last downto First do begin
    Build := Build + Text[i];
  end;
  Result := Copy(Text,1,First - 1) + Build + Copy(Text,Last + 1,Length(Text));
end;
Example: Flip('abcdefg',2,6) results 'afedcbg'

Offline zyxstand

  • Veteran
  • *****
  • Posts: 1106
  • Mother of all Bombs
Re: Text Flipper
« Reply #1 on: June 26, 2007, 04:28:19 pm »
uhm, why is that useful?
Can't think of anything original to put here...

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Text Flipper
« Reply #2 on: June 26, 2007, 07:01:30 pm »
It could be used for... something like... custom encryption :P thats all I can think of.