converts alphanum string of [0-9A-Z] into integer
@param {string} str
@return {number}
549138
function str2Int36(str) {
    const codes = [];
    for (let i = 0; i < str.length; i++) {
        let code = decodeCharCode2Int36(str.charCodeAt(i));
        if (code !== null) {
            codes.push(code);
        }
    }
    return codes.reverse().reduce((r, v, i) => {
        return r + v * Math.pow(36, i);
    }, 0);
}
1152860
def random_alphanum(length):
    
    charset = string.ascii_letters + string.digits
    return random_string(length, charset)
1320531
public static int calcUtfLength(String str) {
        final int strlen = str.length();
        int utflen = 0;
        for (int i = 0; i < strlen; i++) {
            int c = str.charAt(i);
            if ((c >= 0x0001) && (c <= 0x007F)) {
                utflen++;
            } else if (c > 0x07FF) {
                utflen += 3;
            } else {
                utflen += 2;
            }
        }
        return utflen;
    }
682663
def Alphanumeric(msg=None):
    '''
    
    '''
    def fn(value):
        if not any([
            isinstance(value, numbers.Integral),
            (isinstance(value, float) and value.is_integer()),
            (isinstance(value, basestring) and value.isalnum())
        ]):
            raise Invalid(msg or (
                'Invalid input <{0}>; expected an integer'.format(value))
            )
        else:
            return value
    return fn
1070932
def string_to_int(string, alphabet):
    
    number = 0
    alpha_len = len(alphabet)
    for char in string:
        number = number * alpha_len + alphabet.index(char)
    return number
436698
function(str) {
		if (str instanceof Uint8Array) return str;
		if (!is_hex(str)) {
      throw new TypeError("The provided string doesn't look like hex data");
    }
    var result = new Uint8Array(str.length / 2);
    for (var i = 0; i < str.length; i += 2) {
      result[i >>> 1] = parseInt(str.substr(i, 2), 16);
    }
    return result;
  }
67099
function(str){
    if(_.isUndefined(str))
        str = '00';
    
    return String(str).length % 2 ? '0' + String(str) : String(str);
}
325487
function getStringType(str) {
  if (null == str) {
    return -1;
  }

  if (typeof(str) != 'string') {
    return -1;
  }

  if (str.length == 0 || str == "") {
    return -1;
  }

  var i = 0;
  if (str.length == 40) {
    for (; i < 40; i++) {
      var c = str.charAt(i);
      if (!isHexChar(c)) {
        break;
      }
    }
  }
  if (i == 40) {
    return 1;  //40 Hex, Address
  }

  for (i = 0; i < str.length; i++) {
    var c = str.charAt(i);
    if (!isNumber(c)) {
      break;
    }
  }
  if (i == str.length) {
    return 2;  //Alll Decimal number, BlockNumber
  }

  for (i = 0; i < str.length; i++) {
    var c = str.charAt(i);
    if (c > ' ') {
      return 3;   //At least one visible character
    }
  }

  return -1;
}
267276
function (str) {
            var values, r, g, b, a = 1;
            if ((str.length === 4 || str.length === 7) && str.substr(0, 1) === '#') {
                values = str.match(hexRe);
                if (values) {
                    r = parseHex(values[1]);
                    g = parseHex(values[2]);
                    b = parseHex(values[3]);
                    if (str.length === 4) {
                        r = paddingHex(r);
                        g = paddingHex(g);
                        b = paddingHex(b);
                    }
                }
            } else {
                values = str.match(rgbaRe);
                if (values) {
                    r = parseInt(values[1], 10);
                    g = parseInt(values[2], 10);
                    b = parseInt(values[3], 10);
                    a = parseFloat(values[4]) || 1;
                }
            }
            return typeof r === 'undefined' ? undefined : new Color({
                r: r,
                g: g,
                b: b,
                a: a
            });
        }
1054988
function getAlphaHex(alpha) {
    var num = Math.round(alpha * 255);
    var hex = num.toString(16);

    return hex.length === 1 ? '0' + hex : hex;
}
398045
function parse (str) {
	var params = str.split('_')
	return {
		float: params[0] === 'F',
		signed: params[0] === 'S',
		bitDepth: parseInt(params[1]),
		byteOrder: params[2],
		channels: parseInt(params[3]),
		sampleRate: parseInt(params[4]),
		interleaved: params[5] === 'I'
	}
}
637734
private boolean isInt(String str) {
        try {
            Integer.parseInt(str);
        } catch (NumberFormatException e) {
            return false;
        }
        return true;
    }
1139598
function stringToUint8Array(str) {
  const arr = new Uint8Array(str.length);
  for (let i = 0, j = str.length; i < j; i++) {
    arr[i] = str.charCodeAt(i);
  }
  return arr;
}
343687
function (str) {
                str = stringify(str);
                var byteArray = [];
                for (var i = 0, l = str.length; i < l; i++) {
                    if (str.charCodeAt(i) <= 0x7F) {
                        byteArray.push(str.charCodeAt(i));
                    }
                    else {
                        var h = encodeURIComponent(str.charAt(i)).slice(1).split('%');
                        for (var j = 0; j < h.length; j++) {
                            byteArray.push(parseInt(h[j], 16));
                        }
                    }
                }
                return byteArray;
            }
1257135
function (str) {
		return str.replace
		(/(^[a-z]+)|[0-9]+|[A-Z][a-z]+|[A-Z]+(?=[A-Z][a-z]|[0-9])/g
			, function (match, first) {
				if (first) match = match[0].toUpperCase() + match.substr(1);
				return match + ' ';
			}
		)
	}
895970
private int getIntValue(String str, int defaultValue) {

        try {
            int intValue = Integer.parseInt(str);
            return (intValue > 0) ? intValue : defaultValue;
        } catch (NumberFormatException e) {
            // intentionally left blank
        }
        return defaultValue;
    }
1185210
def alphanum_key(string):
    
    convert = lambda text: int(text) if text.isdigit() else text
    return [convert(segment) for segment in re.split('([0-9]+)', string)]