Nodejs String to Hex Convert hex2Dec()

Here you can find the source of hex2Dec()

Method Source Code

/*******************************************************************************
 * Copyright (c) 2012 eBay Inc. and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:// www  . ja  va 2 s  .com
 *     eBay Inc. - initial API and implementation
 *******************************************************************************/
//@Package org.eclipse.vjet.vsf.typeextensions.string
/**
* Converts a number from hexadecimal value to decimal value.
*/
String.prototype.hex2Dec = function() {
   return parseInt(this,16);
};

Related

  1. hex()
    String.prototype.hex = function() {
      return bigInt(this.substr(0)).toHex()
    
  2. hex10()
    String.prototype.hex10 = function() {
      var x= (/^\#/.test(this))? this.substring(1): this;
      return parseInt(x,16);
    
  3. toHex()
    String.prototype.toHex = function () {
        var self = this,
            hex, regex = /\(([^)]+)\)/,
            rgb = regex.exec(self)[1].split(','),
            red = parseInt(rgb[0]), 
            green = parseInt(rgb[1]), 
            blue = parseInt(rgb[2]); 
        function toHEX(r, g, b) {
            r = r.toString(16).length ==1 ? r.toString(16)+r.toString(16):r.toString(16);
    ...
    
  4. toHex()
    String.prototype.toHex = function() {
      for (var i = 1, j = this.length, $ = this.charCodeAt(0).toString(16); i<j; i++) $ += ' ' + this.charCodeAt(i).toString(16);
      return $;
    };
    
  5. toHex(v1)
    Util.toHex = function(v1) {
      var res = (new Number(v1).toString(16));
      if (res.length == 1) {
        res = "0" + res;
      return res;
    
  6. toHexString()
    Number.prototype.toHexString = function() {
      if (this === null) { return null; }
      if (isNaN(this)) { return this; }
      var num;
      var hex;
      if (this < 0) {
        num = 0xFFFFFFFF + this + 1;
      else {
    ...