Aside from the fact that this is not as simple a method as doing a
String.split() and then joining each array element, your method
didn't keep the return value after each recursion. I added a local
var for clarity.
================================
function eliminateSpaces(phrase:String):String {
var testString:String = phrase;
var finalResult:String;
var foundSpace = testString.indexOf(" ");
if (foundSpace != -1) {
testString = String(testString.substring(0, foundSpace) +
testString.substring(foundSpace + 1));
if (testString.indexOf(" ") != -1) {
testString = eliminateSpaces(testString);
} else {
trace("output: " + testString);
}
}
return testString;
}
var s:String = eliminateSpaces("moe and larry and curly");
trace(s);
jord
On Jul 24, 2007, at 4:22 PM, Mendelsohn, Michael wrote:
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?
Jordan L. Chilcott, President
Interactivity Unlimited
Guelph, Ontario
---------------------------------
Tel: (519) 837-1879
Fax: (519) 837-8610
mailto:[EMAIL PROTECTED]
http://www.interactivityunlimited.com
iChat/AIM: j1chilcott
Skype: bear-faced-cow
SightSpeed: [EMAIL PROTECTED]
Author: "Building Web Sites with Macromedia Studio MX"
Author: "Building Dynamic Web Sites with Macromedia Studio MX"
Author: "Flash Professional 8: Training From the Source"
Author: "Foundation Flash 8 Video"
_______________________________________________
Flashcoders@chattyfig.figleaf.com
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