Jump to content

How do I strip newlines from a string gotten from local chat?


Domitan Redenblack
 Share

You are about to reply to a thread that has been inactive for 4807 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

If you could always predict that people were going to type \n and that it was always at the end of the message , then you could just write something like

integer idx = llSubStringIndex(data,"\n");

if (~idx){

     data = llGetSubString(data,0,idx-1);

}

That would take out everything following the first instance of "\n".  If \n is somewhere else in the string, though, you'd risk losing stuff after it. It would be safer to make multiple passes on the line, deleting one instance of \n on each pass.

Link to comment
Share on other sites

Yes, "\n" on the chat bar will only be those characters and not an escape sequence. To insert a real newline in the SL viewer, we have to cheat a little and type a ¶ character, the same one we see in multiline paste. I hope that nobody ever wants to type a ¶ in chat!

[ For random travelers, that is Alt+0182 on Windows, option+7 on Mac OS. ]

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4807 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...