Java ASCII from toAscii(char source)

Here you can find the source of toAscii(char source)

Description

to Ascii

License

Open Source License

Declaration

public static char toAscii(char source) 

Method Source Code

//package com.java2s;
/* Copyright (c) 2014 Karol Stasiak
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*//*from w w w . j  av  a  2s  .c  o  m*/

public class Main {
    private static final String tab00c0 = "AAAAAAACEEEEIIII" + "DNOOOOOxOUUUUYTs" + "aaaaaaaceeeeiiii"
            + "dnooooo/ouuuuyty" + "AaAaAaCcCcCcCcDd" + "DdEeEeEeEeEeGgGg" + "GgGgHhHhIiIiIiIi" + "IiJjJjKkkLlLlLlL"
            + "lLlNnNnNnnNnOoOo" + "OoOoRrRrRrSsSsSs" + "SsTtTtTtUuUuUuUu" + "UuUuWwYyYZzZzZzs";

    public static char toAscii(char source) {
        if (source >= 0xc0 && source <= 0x17f) {
            return tab00c0.charAt(source - 0xc0);
        }
        return source;
    }
}

Related

  1. toAscii(byte[] b)
  2. toAscii(byte[] ba)
  3. toAscii(char ch)
  4. toAscii(int i, boolean reversed)
  5. toAscii(int number)
  6. toAscii(String hexStr)
  7. toAscii(String notAscii)