Red King
Junior Member
Posts: 21
– / / –
Joined: Feb 2007
|
O.P. RE: RE: a problem scripting :/
quote: Originally posted by markee
This is because you will just be doing one replace after the other on the one string. For example if you had the string "ABC" and replaced "A" with "B" and then "B" with "C" you will just end up with "CCC" rather than the "BCC" you were after.
To overcome this you will have to put the changes into a new variable. This code should help with what you need (using what you have written).
code: var alpha = "abcdefghijklmnopqrstuvwxyz";
var code = "ypltavkrezgmshubxncdijfqow";
var Split = Message.split("");
var eSplit = new Array();
for(i=0;i<Split.length;i++){
for(j=0;j<alpha.length;j++){
if(Split[i] == alpha.charAt(j)){
eSplit[i] = code.charAt(j);
break;
}
}
}
var eMessage = eSplit.join("");
Debug.Trace(eMessage);
I hope this extract helps you.
thank you
i really appreciate it i'll try it out now
edit: i tried that and it's not replacing anything now is there anything else i'm supposed to add to all this?
This post was edited on 02-13-2007 at 10:59 PM by Red King.
|
|