Decodes four chars into an 24 bit number

@name decode4

@param {String} s the chars to decode
@returns {Number} a 24 bit number
3871
function decode4(s) {
  assert.equal(s.length, 4)
  const [ upper, belowUpper, aboveLower, lower ] = s
  return (decode(upper) << 18) | (decode(belowUpper) << 12)
    | (decode(aboveLower) << 6) | decode(lower)
}
1022521
private static CharSequence decode0(final CharSequence s) {
    final int length = s.length();
    final CharBuffer cb = CharBuffer.allocate(length);

    for (int i = 0; i < length; ) {
      final char c = s.charAt(i);

      // Not encoded?
      if (c != '%') {
        cb.append(c);
        i++;
        continue;
      }

      // UTF8 - 1 Byte
      int b1 = decodePercent(s, length, i);
      if (b1 == INVALID) {
        return null;
      }
      i += 3;
      final int n = utf8Length(b1);
      if (n == INVALID) {
        return null;
      }
      if (n == 1) {
        cb.append((char) b1);
        continue;
      }

      // UTF8 - 2 Bytes
      final int b2 = decodePercent(s, length, i);
      if (b2 == INVALID) {
        return null;
      }
      i += 3;
      if (n == 2) {
        final int cp = utf8Read2(b1, b2);
        if (cp == INVALID) {
          return null;
        }
        cb.append((char) cp);
        continue;
      }

      // UTF8 - 3 Bytes
      final int b3 = decodePercent(s, length, i);
      if (b3 == INVALID) {
        return null;
      }
      i += 3;
      if (n == 3) {
        final int cp = utf8Read3(b1, b2, b3);
        if (cp == INVALID) {
          return null;
        }
        cb.append((char) cp);
        continue;
      }

      // UTF8 - 4 Bytes
      final int b4 = decodePercent(s, length, i);
      if (b4 == INVALID) {
        return null;
      }
      i += 3;
      final int cp = utf8Read4(b1, b2, b3, b4);
      if (cp == INVALID) {
        return null;
      }
      final int offset = cp - MIN_SUPPLEMENTARY_CODE_POINT;
      cb.append((char) ((offset >>> 10) + MIN_HIGH_SURROGATE));
      cb.append((char) ((offset & 0x3ff) + MIN_LOW_SURROGATE));
    }

    cb.flip();
    return cb;
  }
240017
function decodeLength(s) {
	var size = new type.UInt8().read(s).value;
	if(size & 0x80) {
		size &= ~0x80;
		if(size === 1) {
			size = new type.UInt8().read(s).value;
		}
		else if(size === 2) {
			size = new type.UInt16Be().read(s).value;
		}
		else{
			throw new error.ProtocolError('NODE_RDP_ASN1_BER_INVALID_LENGTH');
		}
	}
	return size;
}
1352269
public static String decodePercentage(String s) {
    StringBuilder result = new StringBuilder();
    int[] eatLength = new int[1];
    while (s.length() != 0) {
      char c = eatPercentage(s, eatLength);
      if (eatLength[0] > 1) {
        result.append(c);
        s = s.substring(eatLength[0]);
      } else {
        result.append(s.charAt(0));
        s = s.substring(1);
      }
    }
    return (result.toString());
  }
469527
def decode(self, s):
        
        if isinstance(s, str) and '&' in s:
            for x in self.decodings:
                s = s.replace(x[0], x[1])
        return s
1143213
public static String decodeString(String s) {

        try {
            return new String(CODEC.decode(s), "UTF-8");
        } catch (UnsupportedEncodingException e) {
            // shouldn't happen
            return null;
        }
    }
1185112
function readNumericString(s, minValue) {
    var length = readLength(s);
    length = (length + minValue + 1) / 2;
    s.readPadding(length);
}
1012479
public static String decodeAmpersand(String s) {
    if(s==null || s.indexOf('&')==-1) return(s);
    StringBuilder result = new StringBuilder();
    int[] eatLength = new int[1];// add this in order to multithread safe
    while (s.length() != 0) {
      char c = eatAmpersand(s, eatLength);
      if (eatLength[0] > 1) {
        result.append(c);
        s = s.substring(eatLength[0]);
      } else {
        result.append(s.charAt(0));
        s = s.substring(1);
      }
    }
    return (result.toString());
  }
786721
def decode_string(s):
    
    stack = []; cur_num = 0; cur_string = ''
    for c in s:
        if c == '[':
            stack.append((cur_string, cur_num))
            cur_string = ''
            cur_num = 0
        elif c == ']':
            prev_string, num = stack.pop()
            cur_string = prev_string + num * cur_string
        elif c.isdigit():
            cur_num = cur_num*10 + int(c)
        else:
            cur_string += c
    return cur_string
148537
function decode(data) {
    var prefix = protocols[data[0]];
    if (!prefix) { // 36 to 255 should be ""
        prefix = "";
    }    
    return prefix + util.bytesToString(data.slice(1));      
}
517707
function decodeCssEscape(s) {
    var i = parseInt(s.substring(1), 16);
    // If parseInt didn't find a hex diigt, it returns NaN so return the
    // escaped character.
    // Otherwise, parseInt will stop at the first non-hex digit so there's no
    // need to worry about trailing whitespace.
    if (i > 0xffff) {
      // A supplemental codepoint.
      return i -= 0x10000,
        String.fromCharCode(
            0xd800 + (i >> 10),
            0xdc00 + (i & 0x3FF));
    } else if (i == i) {
      return String.fromCharCode(i);
    } else if (s[1] < ' ') {
      // "a backslash followed by a newline is ignored".
      return '';
    } else {
      return s[1];
    }
  }
112189
function(encoded) {
      var numbers = [];

      var current = 0;
      var shift = 0;

      var encodedLength = encoded.length;
      for (var i = 0; i < encodedLength; ++i) {
        var b = encoded.charCodeAt(i) - 63;

        current |= (b & 0x1f) << shift;

        if (b < 0x20) {
          numbers.push(current);
          current = 0;
          shift = 0;
        } else {
          shift += 5;
        }
      }

      return numbers;
    }
700085
public static long decode(String s) {
		long n = 0;
		for (int i = 0, max = s.length(); i < max; i++) {
			n = (n * 62) + encoding.indexOf(s.charAt(i));
		}
		return n;
	}
766952
public static String decode(String s) {
        if (s == null) {
            return null;
        }

        int i = s.indexOf('%');
        if (i == -1) {
            return s;
        }

        StringBuilder builder = new StringBuilder();
        int begin = 0;

        do {
            builder.append(s, begin, i);
            begin = i + 3;

            char ch = (char) Integer.parseInt(s.substring(i + 1, begin), 16);

            if ((ch & 0x80) != 0) {
                // Decode "modified UTF-8".

                if (s.charAt(begin++) != '%') {
                    throw new IllegalArgumentException();
                }

                char ch2 = (char) Integer.parseInt(s.substring(begin, begin + 2), 16);
                begin += 2;

                if ((ch & 0xe0) == 0xc0) {
                    ch = (char) (((ch & 0x1f) << 6) | (ch2 & 0x3f));
                } else if ((ch & 0xf0) == 0xe0) {
                    if (s.charAt(begin++) != '%') {
                        throw new IllegalArgumentException();
                    }

                    char ch3 = (char) Integer.parseInt(s.substring(begin, begin + 2), 16);
                    begin += 2;

                    ch = (char) (((ch & 0x0f) << 12) | ((ch2 & 0x3f) << 6) | (ch3 & 0x3f));
                } else {
                    throw new IllegalArgumentException();
                }
            }

            builder.append(ch);
        } while ((i = s.indexOf('%', begin)) != -1);

        builder.append(s, begin, s.length());

        return builder.toString();
    }
1181197
function decodeFor(n) {
  return (
      n === 1 ? decode
    : n === 2 ? decode2
    : n === 3 ? decode3
    : n === 4 ? decode4
    : decode5
  )
}
966525
function decode(str) {
  const [hrp, data] = deserialize(str);

  if (data.length === 0 || data.length > 65)
    throw new Error('Invalid bech32 data length.');

  if (data[0] > 16)
    throw new Error('Invalid bech32 version.');

  const version = data[0];
  const output = data;
  const hash = convert(data, output, 5, 8, -1, 1);

  if (hash.length < 2 || hash.length > 40)
    throw new Error('Invalid bech32 data length.');

  return new AddrResult(hrp, version, hash);
}
1087569
public static byte[] decode(String s) {
        if (s == null) {
            throw new NullPointerException("Input string was null.");
        }

        byte[] bytes = s.getBytes(UTF_8);
        return decode(bytes, 0, bytes.length);
    }