Skip to content

Instantly share code, notes, and snippets.

@jpemberthy
Created April 3, 2009 13:15
Show Gist options
  • Save jpemberthy/89745 to your computer and use it in GitHub Desktop.
Save jpemberthy/89745 to your computer and use it in GitHub Desktop.
function StripString(str : String){
str = str.Trim();
var strOrganized : String = "";
var addSpace : boolean = true;
for(var i = 0; i < str.length; i++){
if(str[i] == " "){
if(addSpace){
addSpace = false;
strOrganized += str[i];
}
} else {
strOrganized += str[i];
addSpace = true;
}
}
return strOrganized;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment