如何使用as2中的charAt更改字符串中的特定字母

时间:2016-03-04 17:22:58

标签: flash actionscript-2 flash-8

我有一个这样的钥匙:

72ea6c148e5fa2f92abbefb86387dbd31cda8581

现在我想改变我的'a'键的每个'a'。 到目前为止,我已经编写了这段代码,可以在我的字符串中找到每个'a'。

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;
        }

但遗憾的是我不知道如何将我的特定字母更改为其他内容。 我现在应该怎么做!? 欢迎AS2解决方案!

1 个答案:

答案 0 :(得分:1)

从google上的小搜索: String.replace() method for ActionScript2, 或this answer

相关问题