Node.js examples for String:sub string
Return a new string with any spaces trimmed the left and right of the string
/**//ww w . java 2 s. c o m * Return a new string with any spaces trimmed the left and right of the string * @version 1.0.0 * @date June 30, 2010 * @package jquery-sparkle {@link http://www.balupton/projects/jquery-sparkle} * @author Benjamin "balupton" Lupton {@link http://www.balupton.com} * @copyright (c) 2009-2010 Benjamin Arthur Lupton {@link http://www.balupton.com} * @license GNU Affero General Public License version 3 {@link http://www.gnu.org/licenses/agpl-3.0.html} */ String.prototype.trim = String.prototype.trim || function() { // Trim off any whitespace from the front and back return this.replace(/^\s+|\s+$/g, ''); };