String VIETNAMESE_DIACRITIC_CHARACTERS = "ẮẰẲẴẶĂẤẦẨẪẬÂÁÀÃẢẠĐẾỀỂỄỆÊÉÈẺẼẸÍÌỈĨỊỐỒỔỖỘÔỚỜỞỠỢƠÓÒÕỎỌỨỪỬỮỰƯÚÙỦŨỤÝỲỶỸỴ"; for (char c: VIETNAMESE_DIACRITIC_CHARACTERS.toCharArray()) { System.out.println(c + ": " + Character.getName(c)); }
public String render(CharSequence str) { String s = ""; for (int i = str.length() - 2; i < str.length(); i++) { final char c = str.charAt(i); s += Character.getName(c); } return s; }
for (int cp = 32; cp < 48; ++cp) { System.out.printf("%c : %s%n", cp, Character.getName(cp)); } : SPACE ! : EXCLAMATION MARK " : QUOTATION MARK # : NUMBER SIGN $ : DOLLAR SIGN % : PERCENT SIGN & : AMPERSAND ' : APOSTROPHE ( : LEFT PARENTHESIS ) : RIGHT PARENTHESIS * : ASTERISK + : PLUS SIGN , : COMMA - : HYPHEN-MINUS . : FULL STOP / : SOLIDUS
void dump(String s) { int n = 0; for (int i = 0; i < s.length(); ++n) { int cp = s.codePointAt(i); int bytes = Character.charCount(cp); i += bytes; System.out.printf("[%d] #%dB: U+%X = %s%n", n, bytes, cp, Character.getName(cp)); } System.out.printf("Length:%d%n", n); }
String s = "१२३"; for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); System.out.printf("%s is digit %s%n", Character.getName(c), Character.isDigit(c)); }
int[] codePoints = { 0x03F3, 0x006A}; for (int codePoint : codePoints) { char lowerCase = (char) Character.toLowerCase(codePoint); char upperCase = (char) Character.toUpperCase(codePoint); System.out.printf("Unicode name: %s%n", Character.getName(codePoint)); System.out.printf("lowercase : %s%n", lowerCase); System.out.printf("uppercase : %s (%s)%n", upperCase, Character.isUpperCase(upperCase)); }
String str = "ิ"; // \u0E34 System.out.println("character length: " + str.length()); System.out.print("bytes: "); for (byte b : str.getBytes("UTF-8")) { System.out.append(Integer.toHexString(b & 0xFF).toUpperCase() + " "); } System.out.println(""); int codePoint = Character.codePointAt(str, 0); System.out.println("unicode name of the codepoint: " + Character.getName(codePoint));
public static String aboutCodepoint( Integer cp ) { StringBuilder sb = new StringBuilder( ); char[] chars = Character.toChars( cp ); sb.append( asUnicodeHex( cp ) ); sb.append( " " ).append( chars ); sb.append( " " ).append( Character.getName( cp ) ); return sb.toString( ); }
for (int codePoint = 0x600; codePoint < 0x900; ++codePoint) { if (Character.isAlphabetic(codePoint) && UnicodeScript.of(codePoint) == UnicodeScript.ARABIC) { System.out.printf("\u200E\\%04X \u200F%s\u200E %s%n", codePoint, new String(Character.toChars(codePoint)), Character.getName(codePoint)); } }
public static String aboutCodepoint( Integer cp ) { StringBuilder sb = new StringBuilder( ); char[] chars = Character.toChars( cp ); sb.append( asUnicodeHex( cp ) ); sb.append( " " ).append( chars ); sb.append( " " ).append( Character.getName( cp ) ); return sb.toString( ); }
import java.nio.charset.StandardCharsets; public class Dashes { public static void main(String[] args) { // see: https://en.wikipedia.org/wiki/Dash byte[] enDash = {-30, -128, -109}; byte[] minusSign = {45}; byte[] emDash = {-30, -128, -108}; byte[][] charBytes = new byte[3][]; charBytes[0] = enDash; charBytes[1] = minusSign; charBytes[2] = emDash; for (byte[] bytes : charBytes) { String s = new String(bytes, StandardCharsets.UTF_8); char c = s.charAt(0); System.out.printf("%d %s %s%n", s.length(), c, Character.getName(c)); } } }
public static void main(String[] args) { // Creators World worldMap = new World(mapWidth, mapHeight); Character john = new Character("John", 0, 0); Character mary = new Character("Mary", 1, 4); worldMap.add(john); worldMap.add(mary); for (int x = 0; x < mapWidth; x++) { worldMap.setTileType(x, 5, "forest"); } // Printing out info about character(s) //I think the world map should have a list of characters. for (Character character : charList) { System.out.print(character+": " + character.getName() + "\n"); } System.out.print("\n"+charList.size() + " characters in play\n\n"); List<Tile> tileList = worldMap.getTiles(); // Printing out info about tile(s) for (Tile tile : tileList) { System.out.print(tile + " type: " + tile.getType() + "\n"); } System.out.print("\n"+tileList.size() + " tiles in play"); }
/** * Converting first char of identifier. This happen only if this char is * non-java char. * * @param firstChar * - first char * @param existNext * - existing of next char behind actual char * @return converted char */ private static String convertFirst(final char firstChar, final boolean existNext) { final String name = DASH_OR_SPACE_MATCHER.replaceFrom(Character.getName(firstChar), UNDERSCORE); return existNext ? name + '_' : name; }
public class CharacterMapAssert extends AbstractMapAssert<MapAssert<Character, Integer>, Map<Character, Integer>, Character, Integer> { public CharacterMapAssert(Map<Character, Integer> actual) { super(actual, CharacterMapAssert.class); } public static CharacterMapAssert assertThat(Map<Character, Integer> actual) { return new CharacterMapAssert(actual); } public CharacterMapAssert hasNameWithAge(String name, int age) { isNotNull(); for (Map.Entry<Character, Integer> entrySet : actual.entrySet()) { if (entrySet.getKey().getName().contains(name) && (int) entrySet.getValue() == age) { return this; } } String msg = String.format("entry with name %s and age %s does not exist", name, age); throw new AssertionError(msg); } }
jasonString.toCodePoints() .filter(cp -> cp >= 256) .forEach(cp -> { System.out.printf("U+%X = %s%n", cp, Character.getName(cp)); }); boolean containsEmoji(String s) { return s.codePoints().anyMatch(cp -> UnicodeBlock.of(cp).equals(UnicodeBlock.EMOTICONS)); }
System.out.print(c.getName());
name.setText(c.getName());
public static void main(String[] args) throws UnsupportedEncodingException { Random random = new Random(); byte bytes[] = new byte[16]; random.nextBytes(bytes); printBytes(bytes); final String s = new String(bytes, "UTF-8"); System.out.println(s); printCharacters(s); } private static void printBytes(byte[] bytes) { for (byte aByte : bytes) { System.out.print( Integer.toHexString(Byte.toUnsignedInt(aByte)) + " "); } System.out.println(); } private static void printCharacters(String s) { s.codePoints().forEach(i -> System.out.println(Character.getName(i))); }
codePoint<=0xE01EF; codePoint++) { String cn = Character.getName(codePoint); if (cn!=null && cn.equals(name)) { String unicodeChar =
fmt = mfmt; message.append(String.format(fmt, badCodePoint, Character.getName(badCodePoint)));