Java Char to Int charToInt(char c)

Here you can find the source of charToInt(char c)

Description

Translate between a throw height specified as a symbol of the alphabet we use to denote siteswaps (0 through Z) and it's associated throw height as an int.

License

Open Source License

Declaration

public static int charToInt(char c) throws Exception 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**/*from   w  w w. java  2s .c o  m*/
     * Translate between a throw height specified as a symbol of the alphabet
     * we use to denote siteswaps (0 through Z) and it's associated throw
     * height as an int.
     * 
     * Examples:
     * charToInt('a') returns 10
     */
    public static int charToInt(char c) throws Exception {
        int ret;
        if ('0' <= c && c <= '9')
            ret = c - '0';
        else if ('a' <= c && c <= 'z')
            ret = c - 'a' + 10;
        else if ('A' <= c && c <= 'Z')
            ret = c - 'A' + 10;
        else
            throw new Exception("not allowed char");

        return ret;
    }
}

Related

  1. char2int(char c)
  2. CHAR2QUAL(char qual)
  3. charToIndex(char c)
  4. charToIndex(Character c)
  5. charToInt(char c)
  6. charToInt(char c)
  7. charToInt(char c)
  8. charToInt(char c)
  9. twoChars2Int(char ch, char cl)