String Inverse
#1

i dont know how to explain it but i'll give an example

EG:

INPUT: "hello world!"
OUTPUT: "!dlrow olleh"

has anyone got a function that can do that to the string?
Reply
#2

pawn Код:
stock StringInverse(const string[], dest[])
{
new len = strlen(string);
for(new i=0; i < len; i++)
    dest[i] = string[len-i];
return dest;
}
ok, i done that xd
Reply
#3

thanks to both of you

by the way, which of those two functions are better heh?
Reply
#4

pawn Код:
public OnGameModeInit()
{
    new string2[15]; // ******'s
    new string3[15]; // Minokon's
    StringReverse("Holy cow!",string2,15); //******'s
    print(string2);
    StringInverse("Holy cow!",string3); //Minokon's
    print(string3);
    return 1;
}
******'s printed "!woc yloH" while Minokon's printed null.
Reply
#5

Quote:
Originally Posted by [XST]O_x
Посмотреть сообщение
[pawn]
******'s printed "!woc yloH" while Minokon's printed null.
Because Minokon's put the end of string char at the beginning of the string!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)