List of usage examples for java.lang Character isLowerCase
public static boolean isLowerCase(int codePoint)
From source file:Main.java
public static String convertCamelCaseToAllCaps(String qualifiedClassName) { StringBuffer sb = new StringBuffer(); final char[] charArray = qualifiedClassName.toCharArray(); for (int c = 0; c < charArray.length; c++) { char character = charArray[c]; final boolean isEnd = c + 1 == charArray.length; boolean nextIsUpper = !isEnd && Character.isUpperCase(charArray[c + 1]); boolean nextNextIsLower = c + 2 < (charArray.length) && Character.isLowerCase(charArray[c + 2]); sb.append(Character.toUpperCase(character)); if (Character.isLowerCase(character) && nextIsUpper) { sb.append('_'); } else {//w w w .j a v a 2s . c o m if (nextIsUpper && nextNextIsLower) { sb.append('_'); } } } return sb.toString(); }
From source file:Main.java
private static boolean isCapsLock(String word) { for (int i = 0; i < word.length(); i++) { if (Character.isLowerCase(word.charAt(i))) return false; }// w w w.j a v a2s. com return true; }
From source file:Main.java
/** * Removes invalid char from element names. *///from www . j a v a 2s .c o m public static String asElementName(String x) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < x.length(); ++i) { char c = x.charAt(i); if (Character.isUpperCase(c) || Character.isLowerCase(c) || Character.isDigit(c) || c == '-' || c == '_') { sb.append(c); } } String elementName = sb.toString(); if (elementName.length() == 0 || (!Character.isUpperCase(elementName.charAt(0)) && !Character.isLowerCase(elementName.charAt(0)))) { return "e" + elementName; } return elementName; }
From source file:com.inkubator.hrm.util.StringsUtils.java
public static Boolean isHaveLowerCase(String str) { Boolean isCondition = Boolean.FALSE; for (int i = str.length() - 1; i >= 0; i--) { if (Character.isLowerCase(str.charAt(i))) { isCondition = Boolean.TRUE; }/* w w w . java 2 s . co m*/ } return isCondition; }
From source file:Main.java
/** * A deliberately very inflexible camel case to underscored converter; it must not convert improper camel case * names to a proper underscored name./*from w w w .ja v a2 s . c o m*/ */ public static String camelCaseToUnderscored(String camelCaseName) { int i = 0; while (i < camelCaseName.length() && Character.isLowerCase(camelCaseName.charAt(i))) { i++; } if (i == camelCaseName.length()) { // No conversion needed return camelCaseName; } StringBuffer sb = new StringBuffer(); sb.append(camelCaseName.substring(0, i)); while (i < camelCaseName.length()) { final char c = camelCaseName.charAt(i); if (isUpperUSASCII(c)) { sb.append('_'); sb.append(Character.toLowerCase(c)); } else { sb.append(c); } i++; } return sb.toString(); }
From source file:Main.java
/** * Convert a java type into a xml name E.g. XMLType = "xmlType", String = * "string", StringBIG = "StringBIG"/* www .ja v a 2 s . c o m*/ */ public static final String toXMLName(final String name) { final StringBuilder builder = new StringBuilder(); boolean firstWord = true; for (int i = 0; i < name.length(); i++) { final char c = name.charAt(i); if (i == 0) { builder.append(Character.toLowerCase(c)); } else { if (firstWord) { if (i + 2 < name.length() && Character.isLowerCase(name.charAt(i + 2))) { firstWord = false; } builder.append(Character.toLowerCase(c)); } else { builder.append(c); } } } return builder.toString(); }
From source file:MyKeyListener.java
public void keyTyped(KeyEvent evt) { JTextComponent c = (JTextComponent) evt.getSource(); char ch = evt.getKeyChar(); if (Character.isLowerCase(ch) == false) { return;/* w ww . j ava2 s. c o m*/ } try { c.getDocument().insertString(c.getCaretPosition(), "" + Character.toUpperCase(ch), null); evt.consume(); } catch (BadLocationException e) { } }
From source file:StringUtils.java
private static int getCharKind(int c) { if (c == -1) { return EOI; }// w ww . j a v a 2 s . co m char ch = (char) c; if (Character.isLowerCase(ch)) return LOWER; else if (Character.isUpperCase(ch)) return UPPER; else if (Character.isDigit(ch)) return DIGIT; else return OTHER; }
From source file:com.threecrickets.jygments.style.Style.java
public static Style getByName(String name) throws ResolutionException { if (Character.isLowerCase(name.charAt(0))) name = Character.toUpperCase(name.charAt(0)) + name.substring(1) + "Style"; Style style = getByFullName(name); if (style != null) return style; else {// www . ja va 2 s . c o m // Try contrib package String pack = Jygments.class.getPackage().getName() + ".contrib"; name = pack + "." + name; style = getByFullName(name); if (style == null) throw new ResolutionException("Could not load style: " + name); return style; } }
From source file:StringUtil.java
public static String caps(String string) { if (string.length() == 0) { return string; }/* w w w. ja va 2s. c om*/ char ch = string.charAt(0); if (Character.isLowerCase(ch)) { ch = Character.toUpperCase(ch); return ch + string.substring(1); } return string; }