Change a string? easy one i think

hi there!

thanks in advance for checking this post…
i think this is a easy one…

i’m trying to edit the last character of a string…but have no idea on how to do it…

any ideas?

like - replace the last character with something else?

for more information - look up the String class here: adobe livedocs


var str:String = "asdfasdf";
// the substr method will take all characters starting at index 0 up to the last character minue one.
var strreplace:String = str.substr(0,-1)+"Q"
trace(strreplace); // output: asdfasdQ

thanks !

you rule! :smiley: