Java Char to Int charToInt(char c)

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

Description

Convert a character to a digit.

License

Academic Free License

Declaration

public static int charToInt(char c) 

Method Source Code

//package com.java2s;
// Licensed under the Academic Free License version 3.0

public class Main {
    /**/*from w w  w .j a v a2 s  .  c  o m*/
     * Convert a character to a digit.  For example
     * the char '3' will return 3.
     */
    public static int charToInt(char c) {
        int x = c - '0';
        if (x < 0 || x > 9)
            throw new IllegalArgumentException("'" + (char) c + "'");
        return x;
    }
}

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)