FLEX - Function to convert a string into Camel Casing:
public 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;
}
Thanks for Visiting.....
public 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;
}
Thanks for Visiting.....
No comments:
Post a Comment