Removing spaces at the end of a string
#1

Hello, I want to make this:
Quote:

"Hello! " ===> "Hello!"

I tried to do it by myself so this is the result and it doesn't work:
Quote:

new pos = strlen(thestring);
while(thestring[pos] == ' '){pos--;}
strdel(thestring, pos, strlen(text));

Reply
#2

Check this out buddy : http://forum.sa-mp.com/showthread.ph...t=slice+string

KillerDVX,
Reply
#3

Thank you KillerDVX,
So I have to use strtrim:
Quote:

new string[128] = " XXbla blaY ";

strtrim(string); // string = "XXbla blaY"
strtrim(string, "XY"); // string = "bla bla"

string = "/Users/home/bla/bla/";

strtrim(string, "/\\", .edges = trim_right); // string = "/Users/home/bla/bla"

Reply
#4

Exactly ! ^^

Good luck buddy ! :3

KillerDVX,
Reply
#5

Merci! :v
Reply
#6

FR : De rien !

ENG : Your welcome !

KillerDVX,
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)