I was kinda bored, and i got to thinking, "Hey, there's no way to tell if a username is too long, or if contains invalid characters (underscores, @,#,$, etc...), is there?!" so i made this, i makes any string just like a RS username would be, it'd be useful like:
SCAR Code:procedure DeclarePlayers;
begin
Players[0].Name:= RsLikeUsername({Insert Username here!});
//blah blah, the rest of the players code here
end;
Well, here it is:
SCAR Code:program RsLikeUsername;
function RsLikeUsername(S: string): string;
var
i: Integer;
begin
s:= Lowercase(s);
s:= Replace(s,'_',' ');
for i:= 33 to 47 do
s:= Replace(s,Chr(i),'');
for i:= 58 to 64 do
s:= Replace(s,Chr(i),'');
for i:= 91 to 96 do
s:= Replace(s,Chr(i),'');
for i:= 123 to 126 do
s:= Replace(s,Chr(i),'');
s:= Trim(s);
s:= Capitalize(s);
i:= 0;
repeat
s:= Replace(s,' ',' ');
until(Pos(' ',s)=0);
if(Length(s)>=12) then
Delete(s,13,Length(s)-12);
Result:= s;
end;
begin
Writeln(RsLikeUsername('!@@@@. #__-_w__$#$%^&^%o___$r#%^ %$% & *(__ _*&^%$#$ ___%k^%%{} {{}{:"">?>s?":{:%^_&* ( '));
end.
And the output is:
SCAR Code:Successfully compiled
W O R K S
Successfully executed
Wow, i made that like 50 lines shorter since i started it lol
EDIT: uhh... what's the difference between "Replace" and "ReplaceRegex"? cause i used both, and they seem to be interchangeable...
