Splitting string after length
#1

pawn Код:
if(strlen(message) <= 51)
        {
        format(string,sizeof(string),"~g~Update: ~w~%s", message);
        }
        else
        {
// Do splitting crap.
          format(string,sizeof(string),"~g~Update: ~w~%s~n~%s", message[firstline], message[secondline]);
        }
I want to make it so that if its above 51 characters it'll create a new line, it's just the splittings the problem.

So like, "The blue cat went around the world in his blue tr~n~"
"uck", i want it to start at the beginning of a new word so its like:

"The blue cat went around the world~n~"
"in his blue truck"

If you know what i mean, i've searched but found no result and i don't have the faintest idea how to do this.

Anyone, i would be so greatful.
Reply
#2

Use strmid.

pawn Код:
strmid(string, message, 50, strlen(message)); // String now contains the rest of the message
Reply
#3

Thank you!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)