Removing the last character from a string!

7 posts

Flag Post

(AS3.0, Flex)

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

 
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.

 
Flag Post

Tried that… Could you post it?

 
Flag Post

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

 
Flag Post

Yep, that works! Thanks!

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

 
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

 
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