//FILE NAME: string.js
//Description: functions in this file are for string manipulation

//FUNCTION-- trims white space from beginning and end of text if any
function trim_string(str)
{
 while(str.length > 0 && str.charAt(0) == " ")//trim beginning of text
 {
	str1 = str.substring(1);
	str = str1;
 }

 while(str.length > 0 && str.charAt(str.length -1) == " ")//trim end of text
 {
  str1 = str.substring(0, str.length -1);
  str = str1;
 }
 return str;
}

//FUNCTION-- capitilizes the first character of a string
function first_letter_cap(value)
{
 if(value.length >= 2) //if word has two or more characters
	{
	 var first_letter = value.charAt(0).toUpperCase( ); //capitilize the first character
		var remaining_letters = value.substring(1); //grab the remaining characters after the first character
	 return (first_letter + remaining_letters);
	}
	else if(word.length == 1) return value.charAt(0).toUpperCase(); //if one character
 else if(word.length <= 0) return value; //if no characters
}
//-- end functions ---------------------------------------------------