Removing the last character from a string!

Subscribe to Removing the last character from a string! 7 posts

avatar for SavageWolf SavageWolf 2880 posts
Flag Post

(AS3.0, Flex)

I have been trying for ages, how do you do it?

 
avatar for NicheGamer NicheGamer 472 posts
Flag Post

Use split and join but join a new string with the last character missing? Kinda hackish but it should get the job done.

 
avatar for SavageWolf SavageWolf 2880 posts
Flag Post

Tried that… Could you post it?

 
avatar for Draco18s Draco18s 6860 posts
Flag Post

myString.substring(0,myString.length-1)

 
avatar for SavageWolf SavageWolf 2880 posts
Flag Post

Yep, that works! Thanks!

(Why does everyone use “myString” anyway, it sounds like a baby toy o_O)

 
avatar for Maqrkk Maqrkk 45 posts
Flag Post

Examples often have names like myString, myFunction, myClass.. I guess it makes it easier, so you don’t need any more info to confuse you :P

 
avatar for Draco18s Draco18s 6860 posts
Flag Post
Originally posted by SavageWolf:

Yep, that works! Thanks!

(Why does everyone use “myString” anyway, it sounds like a baby toy o_O)

I could have said foo.substring, but then you’d ask “what’s foo?” and I’ve had said, “well, its like bar, only not.”

“Foo bar,” you say?

Yes, FUBAR.

http://en.wikipedia.org/wiki/Foo