Counting Delinations

[Total: 0    Average: 0/5]

This shows how to determine frequency of a character deliniated string.

Body Code:

<script>
/*
 * 2 parameters:
 *  - string
 *  - deliniation
 */
function countItems(_str,_del)
{
  return _str.split(_del).length;
}

var myString="abc,def,ghi,jkl,mno";
var myDeliniator=",";
var itemCount=countItems(myString,myDeliniator);
document.write("<BR>string="+myString);
document.write("<BR>itemCount: "+itemCount);
</script>

Times Viewed: 0

Leave a Reply

Your email address will not be published. Required fields are marked *