Javascript String toInt()

Description

Javascript String toInt()

String.prototype.toInt = function() {
  return parseInt(this, 10);
};

Javascript String toInt()

String.prototype.toInt = function() {
  return parseInt(this);
}

Javascript String toInt()

/*//from   w ww.  j  a  v a  2 s.c o m
 * String.toInt.js
 * 
 * Copyright (c) 2012 Tomasz Jakub Rup <tomasz.rup@gmail.com>
 *
 * https://github.com/tomi77/Date.toLocaleFormat/
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */

/**
 * Return a int representation of string.
 * 
 * @return int
 */
String.prototype.toInt = function() {
 return parseInt(this);
}

Javascript String toInt()

/**//from  www.  ja va 2s . c om
@function
*/
String.prototype.toInt = function() {
 return parseInt(this, 10);
};



PreviousNext

Related