Hi list...
I've written a simple routine to eliminate spaces from a user entered
string. But, it won't return the string. I'm sure it's something
silly. Can anyone shed light?
- MM
function eliminateSpaces(phrase:String):String {
var foundSpace = phrase.indexOf(" ");
if (foundSpace != -1) {
phrase = String(phrase.substring(0, foundSpace) +
phrase.substring(foundSpace + 1));
if (phrase.indexOf(" ") != -1) {
eliminateSpaces(phrase);
} else {
trace("output: " + phrase);
return phrase;
}
}
}
var s:String = eliminateSpaces("moe and larry and curly");
trace(s);
/* RESULT:
output: moeandlarryandcurly
Undefined
*/
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com