﻿//Returns a string containing a copy of a specified string with no leading or trailing spaces.
function trim(str) {
    //Ltrim
    while (str.charAt(0)==" ")
        str = str.slice(1);

    //Rtrim
    while (str.charAt(str.length-1)==" ")
        str = str.slice(0,-1);

    return str;
}