George Carlin
George Carlin

Reputation: 447

How to change an specific letter in string using charAt in as2

I have a key like this:

72ea6c148e5fa2f92abbefb86387dbd31cda8581

And now I want to change for example every 'a' of my key to 'd'. So far I've written this code which can find every 'a' in my string.

for(var i = key.length; i > 0; i--){
        var eachLetter = (key.charAt((i - 1)));
        switch (eachLetter){
            case 'a':
                trace('the letter is: a');
                //key = key.charAt(i) = 'd';// this is what I'm looking for.
                break;
        }

but unfortunately I don't know how to change my specific letters to something else. what should I do now!? AS2 solutions are welcome!

Upvotes: 0

Views: 72

Answers (0)

Related Questions