hi,
Can anyone help me?
I would like to know if there is a way to detect from [COLOR=“Blue”]star[/COLOR] variable second [COLOR=“Red”]a[/COLOR] and [COLOR=“red”]b[/COLOR] in the following code? I want to compose code to omit first [COLOR=“Red”]a[/COLOR] and [COLOR=“red”]b[/COLOR] and detect only second [COLOR=“Red”]a[/COLOR] and [COLOR=“red”]b[/COLOR]. At the moment it detects both - first and second. And once the second [COLOR=“red”]a[/COLOR] and [COLOR=“red”]b[/COLOR] is detected I want it to be replaced by [COLOR=“red”]g[/COLOR] and [COLOR=“red”]h[/COLOR] so the [COLOR=“blue”]star[/COLOR] variable will have following string: “a b c d e f g h”. Here is the code:
// there are 2 "a" and "b" letters in the string
var star:String = "a b c d e f a b";
for (var l = 0; l<15; l++) {
switch (star.charAt(l)) {
case "a" :
case "b" :
trace("detected:"+star.charAt(l));
break;
}
}
thanks a lot