List of usage examples for java.lang Character toString
public static String toString(int codePoint)
From source file:Main.java
public static void main(String[] argv) { Character character2 = new Character('b'); System.out.println(Character.toString(character2)); }
From source file:Main.java
public static void main(String[] args) { final int columnCount = 10; final int side = 25; final int[][] grid = new int[50][columnCount]; JPanel panel = new JPanel() { public void paintComponent(Graphics g) { Font font = new Font("WingDings", Font.PLAIN, 14); g.setFont(font);//from www . j av a 2 s.co m int off = 0; for (int i = 0; i < 256 * 256; i++) { if (font.canDisplay((char) i) == false) { continue; } off++; grid[off / columnCount][off % columnCount] = i; int x = off % columnCount * side; int y = (off / columnCount) * side + side; g.drawString(Character.toString((char) i), x, y); } } }; JFrame frame = new JFrame(); panel.setSize(300, 300); frame.getContentPane().add(panel); frame.setSize(300, 300); frame.setVisible(true); }
From source file:MainClass.java
public static void main(String[] a) { Display d = new Display(); Shell s = new Shell(d); s.setSize(250, 200);/*from ww w . j av a 2s . c om*/ s.setText("A KeyListener Example"); s.setLayout(new RowLayout()); final Combo c = new Combo(s, SWT.DROP_DOWN | SWT.BORDER); c.add("A"); c.add("B"); c.add("C"); c.add("D"); c.addKeyListener(new KeyListener() { String selectedItem = ""; public void keyPressed(KeyEvent e) { if (c.getText().length() > 0) { return; } String key = Character.toString(e.character); String[] items = c.getItems(); for (int i = 0; i < items.length; i++) { if (items[i].toLowerCase().startsWith(key.toLowerCase())) { c.select(i); selectedItem = items[i]; return; } } } public void keyReleased(KeyEvent e) { if (selectedItem.length() > 0) c.setText(selectedItem); selectedItem = ""; } }); s.open(); while (!s.isDisposed()) { if (!d.readAndDispatch()) d.sleep(); } d.dispose(); }
From source file:Main.java
public static boolean isChinese(char c) { return Character.toString(c).matches("[\\u4E00-\\u9FA5]+"); }
From source file:Main.java
public static boolean isCNChar(char c) { return Character.toString(c).matches("[\\u4E00-\\u9FA5]+"); }
From source file:Main.java
public static boolean checkIsZH(String input) { char[] charArray = input.toLowerCase().toCharArray(); for (char c : charArray) { String tempC = Character.toString(c); if (tempC.matches("[\u4E00-\u9FA5]+")) { return true; }/*from w w w . j a v a 2s .c om*/ } return false; }
From source file:Main.java
public static String simplifyName(String chordName) { String chord = chordName;// ww w . j a v a 2 s .co m chord = chord.toLowerCase(); // The first letter chord = Character.toString(chord.charAt(0)).toUpperCase() + chord.substring(1); int theChar = chordName.indexOf("/"); if (theChar > -1) { return chord.substring(0, theChar); } else { return chord; } }
From source file:Main.java
public static String clearMonthDate(String word) { String result = ""; for (int i = 0; i < word.length(); i++) { if (TextUtils.isDigitsOnly(Character.toString(word.charAt(i)))) { result += Character.toString(word.charAt(i)); }/*from ww w . ja v a 2 s . c o m*/ } return result; }
From source file:Main.java
public static int lastIndexOfChinese(String text) { char[] charArray = text.toCharArray(); int index = -1; for (int i = 0; i < charArray.length; i++) { String tempC = Character.toString(charArray[i]); if (tempC.matches("[\u4E00-\u9FA5]+")) { index = i;/* w w w. j a v a 2 s .co m*/ } } return index; }
From source file:Main.java
private static ArrayList<String> getBigramms(String word) { ArrayList<String> result = new ArrayList<>(); if (word.length() > 1) { for (int i = 0; i < word.length() - 1; i++) { result.add(Character.toString(word.charAt(i)) + Character.toString(word.charAt(i + 1))); }//from w w w . jav a 2s .c o m } return result; }