XxKanexX
2006-04-19 00:38:18
Re-make of another old script:
function WhatCase(c: char): integer;
var alph: string;
var i, e: integer;
begin
alph:= 'abcdefghijklmnopqrstuvwxyz';
for i:= 1 to length(alph) do
begin
for e:= 1 to length(alph) do
begin
if (i > 1) then
begin
alph:= uppercase(alph);
if (c = strget(alph, e)) then
begin
result:= 2;
exit;
end;
end else
begin
alph:= lowercase(alph);
if (c = strget(alph, e)) then
begin
result:= 1;
exit;
end;
end;
end;
end;
end;
function TextVal(c: char): integer;
var i: integer;
begin
if (WhatCase(c) = 1) then
begin
for i:= 97 to 122 do
begin
if (c = Chr(i)) then
begin
result:= i;
exit;
end;
end;
end else
begin
for i:= 65 to 90 do
begin
if (c = Chr(i)) then
begin
result:= i;
exit;
end;
end;
end;
for i:= 1 to 255 do //Other characters. Or if it didn't find the others.
begin
if (c = Chr(i)) then
begin
result:= i;
exit;
end;
end;
end;
function TextToChri(s: string): string;
var i: integer;
begin
for i:= 1 to length(s) do
begin
if (i >= length(s)) then
result:= result + 'Chr(' + inttostr(TextVal(strget(s, i))) + ')'
else
result:= result + 'Chr(' + inttostr(TextVal(strget(s, i))) + ')' + ' + ';
end;
end;