I have just written the JavaScript function for Propercase.
You can use this function directly by replacing the str value.
I hope this will be helpful.
You can use this function directly by replacing the str value.
var getResult = ProperCase("i am tEstinG tHe propeR cAse funcTion");
function ProperCase(str)
{
var arrstr=new Array();
arrstr=str.split(" ");
var temp_1;
var temp_2;
var result="";
for(var i=0; i<arrstr.length; i++)
{
temp_1=arrstr[i].substr(0,1);
temp_1=temp_1.toUpperCase();
temp_2 = arrstr[i].slice(1);
temp_2 = temp_2.toLowerCase();
result = result+" "+temp_1.concat(temp_2)
}
return result;
}
I hope this will be helpful.
No comments:
Post a Comment