Skip to content

Instantly share code, notes, and snippets.

@sojourning
Created July 5, 2014 20:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sojourning/5c5ad91a2f34c1303236 to your computer and use it in GitHub Desktop.
Save sojourning/5c5ad91a2f34c1303236 to your computer and use it in GitHub Desktop.
//below is the function to create camelString
//needs little cleaning up.
private function camelCaseString(inputstr:String):String
{
var loopcount:int;
var returnstr:String = "";
var origStr:String;
loopcount = inputstr.length;
origStr = inputstr;
while(loopcount>0)
{
var lastSpaceIndex:int = origStr.indexOf(" ",0);
if(lastSpaceIndex<0)
{
lastSpaceIndex=origStr.length;
}
var tempstr:String = origStr.substring(0,lastSpaceIndex);
var firstpartStr:String = tempstr.substr(0,1);
var secondpartStr:String = tempstr.substr(1,tempstr.length);
returnstr = returnstr+firstpartStr.toUpperCase() +secondpartStr.toLowerCase()+" ";
origStr = origStr.substring(lastSpaceIndex+1,origStr.length);
loopcount = loopcount - 1;
}
return returnstr;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment