Java Number Parse toNumber(char letter)

Here you can find the source of toNumber(char letter)

Description

to Number

License

Mozilla Public License

Declaration

public static int toNumber(char letter) 

Method Source Code

//package com.java2s;
/** This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *///  w ww.  j a  v  a  2  s .c  om

public class Main {
    public static int toNumber(char letter) {
        switch (letter) {
        case ' ':
            return 0;
        case 'a':
            return 1;
        case 'b':
            return 2;
        case 'c':
            return 3;
        case 'd':
            return 4;
        case 'e':
            return 5;
        case 'f':
            return 6;
        case 'g':
            return 7;
        case 'h':
            return 8;
        case 'i':
            return 9;
        case 'j':
            return 10;
        case 'k':
            return 11;
        case 'l':
            return 12;
        case 'm':
            return 13;
        case 'n':
            return 14;
        case 'o':
            return 15;
        case 'p':
            return 16;
        case 'q':
            return 17;
        case 'r':
            return 18;
        case 's':
            return 19;
        case 't':
            return 20;
        case 'u':
            return 21;
        case 'v':
            return 22;
        case 'w':
            return 23;
        case 'x':
            return 24;
        case 'y':
            return 25;
        case 'z':
            return 26;
        //
        case 'A':
            return 27;
        case 'B':
            return 28;
        case 'C':
            return 29;
        case 'D':
            return 30;
        case 'E':
            return 31;
        case 'F':
            return 32;
        case 'G':
            return 33;
        case 'H':
            return 34;
        case 'I':
            return 35;
        case 'J':
            return 36;
        case 'K':
            return 37;
        case 'L':
            return 38;
        case 'M':
            return 39;
        case 'N':
            return 40;
        case 'O':
            return 41;
        case 'P':
            return 42;
        case 'Q':
            return 43;
        case 'R':
            return 44;
        case 'S':
            return 45;
        case 'T':
            return 46;
        case 'U':
            return 47;
        case 'V':
            return 48;
        case 'W':
            return 49;
        case 'X':
            return 50;
        case 'Y':
            return 51;
        case 'Z':
            return 52;
        //
        case '1':
            return 53;
        case '2':
            return 54;
        case '3':
            return 55;
        case '4':
            return 56;
        case '5':
            return 57;
        case '6':
            return 58;
        case '7':
            return 59;
        case '8':
            return 60;
        case '9':
            return 61;
        case '0':
            return 62;
        default:
            return 63;
        }
    }
}

Related

  1. isNumeric(String str)
  2. isNumeric(String str)
  3. isNumeric(String str)
  4. isNumeric(String value, Locale locale)
  5. isParsable(Object parser, String str)
  6. toNumber(CharSequence jsonText)
  7. toNumber(final Object obj)
  8. toNumber(Object object, Number defaultValue)
  9. toNumber(Object object, Number defaultValue)