Node.js examples for String:sub string
Return a new string of a selection of the old string wrapped with the start and end values
/**/* ww w . jav a 2 s . c o m*/ * Return a new string of a selection of the old string wrapped with the start and end values * @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.wrapSelection = String.prototype.wrapSelection || function(start,end,a,z){ // Wrap the selection if ( typeof a === 'undefined' || a === null ) a = this.length; if ( typeof z === 'undefined' || z === null ) z = this.length; return this.substring(0,a)+start+this.substring(a,z)+end+this.substring(z); };