-
-
Save sojourning/5c5ad91a2f34c1303236 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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