/******************************************************************
 Name:  rightTrim
 Input:  a string
 Output:  a string
 Function:  It trims all spaces and commas on the right side of the
            string.
 Date:  March 24, 1999
 Created by:  Fekade Sergew
******************************************************************/

function rightTrim(str)
{
  while(str.charAt(str.length - 1) == ' ' || str.charAt(str.length - 1) == ',')
  {
    str = str.substring(0, str.length - 1);
  }

  return str;
}

/******************************************************************
 Name:  leftTrim
 Input:  a string
 Output:  a string
 Function:  It trims all spaces and commas on the left side of the
            string.
 Date:  March 24, 1999
 Created by:  Fekade Sergew
******************************************************************/

function leftTrim(str)
{
  while(str.charAt(0) == ' ' || str.charAt(0) == ',')
  {
    str = str.substring(1, str.length);
  }

  return str;
}

/******************************************************************
 Name:  checkMetaChar
 Input:  a string
 Output: a boolean
 Function:  The function gets a string and checks if the string
            contains any meta characters. If the string contains
            meta characters the function will return false.
 Date:  April 21, 1999
 Created by:  Fekade Sergew
******************************************************************/

function checkMetaChar(str)
{
  var state = true;

  for(var i = 0; i < str.length; i++)
  {
    if((str.charAt(i) == '"') ||
       (str.charAt(i) == '\'') ||
       (str.charAt(i) == '%') ||
       (str.charAt(i) == '\\') ||
       (str.charAt(i) == '*'))
    {
      state = false;
    }
  }

  return state;
}
