What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » a problem scripting :/ [NOW SOLVED THANKS]

a problem scripting :/ [NOW SOLVED THANKS]
Author: Message:
Eljay
Elite Member
*****

Avatar
:O

Posts: 2949
Reputation: 77
– / Male / –
Joined: May 2004
RE: a problem scripting :/
What is probably happening is the following:
+Your script searches for any occurences of "a"
+Your script finds "a" and replaces it with "b"
+Your script searches for "b"
+Your script finds "b", including the "b" that originally was an "a", and replaces it with "c".

The better way to replace letters where there is a possibility of the replacement letter being replaced itself (if that makes any sense outside of my head) is to just loop through each letter in the string.

e.g.
code:
var teststring = "Hello World";
var testarray = teststring.split(""); //convert string into an array
for(i=0;i<testarray.length;i++){
  //do replacing here, get current character with testarray[i];
}
teststring = testarray.join(""); //convert array back to a string

02-13-2007 10:24 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
a problem scripting :/ [NOW SOLVED THANKS] - by Red King on 02-13-2007 at 10:14 PM
RE: a problem scripting :/ - by pollolibredegrasa on 02-13-2007 at 10:23 PM
RE: a problem scripting :/ - by Eljay on 02-13-2007 at 10:24 PM
RE: a problem scripting :/ - by Red King on 02-13-2007 at 10:25 PM
RE: a problem scripting :/ - by markee on 02-13-2007 at 10:39 PM
RE: RE: a problem scripting :/ - by Red King on 02-13-2007 at 10:48 PM
RE: a problem scripting :/ - by Matti on 02-14-2007 at 02:18 PM
RE: RE: a problem scripting :/ - by Red King on 02-14-2007 at 08:47 PM
RE: a problem scripting :/ [NOW SOLVED THANKS] - by markee on 02-14-2007 at 11:04 PM
RE: a problem scripting :/ [NOW SOLVED THANKS] - by Red King on 02-14-2007 at 11:09 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On