function FindMaxItemLength(stritems)
{
var itemsArray=new Array()
itemsArray=stritems.split(",")
var i=0;
var j=0;
var val1='';
var val2='';
var ret_len = 0;
for (i=0;i{
val1=itemsArray[i];
for (j=0;j{
val2=itemsArray[j];
if (val2.length > val1.length)
{
ret_len = val2.length;
}
}
}
return ret_len;
}
PROGRAMMING SOLUTIONS
Tuesday, 30 June 2009
A javascript function that returns the item with the max length in an string array
Note that stritems in our case is a single string, containing other strings separated with comas.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment