List of usage examples for java.lang Character isLowerCase
public static boolean isLowerCase(int codePoint)
From source file:Main.java
public static void main(String[] args) throws java.io.IOException { char c = 'a'; System.out.println("Character = " + (int) c); System.out.println("Defined = " + Character.isDefined(c)); System.out.println("Digit = " + Character.isDigit(c)); System.out.println("Ignorable = " + Character.isIdentifierIgnorable(c)); System.out.println("ISO control = " + Character.isISOControl(c)); System.out.println("Java identifier part = " + Character.isJavaIdentifierPart(c)); System.out.println("Java identifier start = " + Character.isJavaIdentifierStart(c)); System.out.println("Letter = " + Character.isLetter(c)); System.out.println("Letter or digit = " + Character.isLetterOrDigit(c)); System.out.println("Lowercase = " + Character.isLowerCase(c)); System.out.println("Space = " + Character.isSpaceChar(c)); System.out.println("Titlecase = " + Character.isTitleCase(c)); System.out.println("Unicode identifier part = " + Character.isUnicodeIdentifierPart(c)); System.out.println("Unicode identifier start = " + Character.isUnicodeIdentifierStart(c)); System.out.println("Uppercase = " + Character.isUpperCase(c)); System.out.println("White space = " + Character.isWhitespace(c)); byte[] types = { Character.COMBINING_SPACING_MARK, Character.CONNECTOR_PUNCTUATION, Character.CONTROL, Character.CURRENCY_SYMBOL, Character.DASH_PUNCTUATION, Character.DECIMAL_DIGIT_NUMBER, Character.ENCLOSING_MARK, Character.END_PUNCTUATION, Character.FORMAT, Character.LETTER_NUMBER, Character.LINE_SEPARATOR, Character.LOWERCASE_LETTER, Character.MATH_SYMBOL, Character.MODIFIER_SYMBOL, Character.NON_SPACING_MARK, Character.OTHER_LETTER, Character.OTHER_NUMBER, Character.OTHER_PUNCTUATION, Character.OTHER_SYMBOL, Character.PARAGRAPH_SEPARATOR, Character.PRIVATE_USE, Character.SPACE_SEPARATOR, Character.START_PUNCTUATION, Character.SURROGATE, Character.TITLECASE_LETTER, Character.UNASSIGNED, Character.UPPERCASE_LETTER }; String[] typeNames = { "Combining spacing mark", "Connector punctuation", "Control", "Currency symbol", "Dash punctuation", "Decimal digit number", "Enclosing mark", "End punctuation", "Format", "Letter number", "Line separator", "Lowercase letter", "Math symbol", "Modifier symbol", "Non spacing mark", "Other letter", "Other number", "Other punctuation", "Other symbol", "Paragraph separator", "Private use", "Space separator", "Start punctuation", "Surrogate", "Titlecase letter", "Unassigned", "Uppercase letter" }; int type = Character.getType(c); for (int i = 0; i < types.length; i++) if (type == types[i]) { System.out.println("Type name = " + typeNames[i]); break; }/*from w ww .j a v a 2 s .c o m*/ System.out.println("Unicode block = " + Character.UnicodeBlock.of(c)); }
From source file:Classify.java
public static void main(String[] args) throws java.io.IOException { char c = '\u0beb'; // Tamil digit. System.out.println("Character = " + (int) c); System.out.println("Defined = " + Character.isDefined(c)); System.out.println("Digit = " + Character.isDigit(c)); System.out.println("Ignorable = " + Character.isIdentifierIgnorable(c)); System.out.println("ISO control = " + Character.isISOControl(c)); System.out.println("Java identifier part = " + Character.isJavaIdentifierPart(c)); System.out.println("Java identifier start = " + Character.isJavaIdentifierStart(c)); System.out.println("Letter = " + Character.isLetter(c)); System.out.println("Letter or digit = " + Character.isLetterOrDigit(c)); System.out.println("Lowercase = " + Character.isLowerCase(c)); System.out.println("Space = " + Character.isSpaceChar(c)); System.out.println("Titlecase = " + Character.isTitleCase(c)); System.out.println("Unicode identifier part = " + Character.isUnicodeIdentifierPart(c)); System.out.println("Unicode identifier start = " + Character.isUnicodeIdentifierStart(c)); System.out.println("Uppercase = " + Character.isUpperCase(c)); System.out.println("White space = " + Character.isWhitespace(c)); byte[] types = { Character.COMBINING_SPACING_MARK, Character.CONNECTOR_PUNCTUATION, Character.CONTROL, Character.CURRENCY_SYMBOL, Character.DASH_PUNCTUATION, Character.DECIMAL_DIGIT_NUMBER, Character.ENCLOSING_MARK, Character.END_PUNCTUATION, Character.FORMAT, Character.LETTER_NUMBER, Character.LINE_SEPARATOR, Character.LOWERCASE_LETTER, Character.MATH_SYMBOL, Character.MODIFIER_SYMBOL, Character.NON_SPACING_MARK, Character.OTHER_LETTER, Character.OTHER_NUMBER, Character.OTHER_PUNCTUATION, Character.OTHER_SYMBOL, Character.PARAGRAPH_SEPARATOR, Character.PRIVATE_USE, Character.SPACE_SEPARATOR, Character.START_PUNCTUATION, Character.SURROGATE, Character.TITLECASE_LETTER, Character.UNASSIGNED, Character.UPPERCASE_LETTER }; String[] typeNames = { "Combining spacing mark", "Connector punctuation", "Control", "Currency symbol", "Dash punctuation", "Decimal digit number", "Enclosing mark", "End punctuation", "Format", "Letter number", "Line separator", "Lowercase letter", "Math symbol", "Modifier symbol", "Non spacing mark", "Other letter", "Other number", "Other punctuation", "Other symbol", "Paragraph separator", "Private use", "Space separator", "Start punctuation", "Surrogate", "Titlecase letter", "Unassigned", "Uppercase letter" }; int type = Character.getType(c); for (int i = 0; i < types.length; i++) if (type == types[i]) { System.out.println("Type name = " + typeNames[i]); break; }//from www . jav a2 s. c o m System.out.println("Unicode block = " + Character.UnicodeBlock.of(c)); }
From source file:Main.java
public static String upperFirstLetter(String s) { if (isEmpty(s) || !Character.isLowerCase(s.charAt(0))) return s; return String.valueOf((char) (s.charAt(0) - 32)) + s.substring(1); }
From source file:Main.java
public static String upperFirstLetter(String string) { if (isEmpty(string) || !Character.isLowerCase(string.charAt(0))) { return string; }//from w w w.j ava 2 s. c o m return String.valueOf((char) (string.charAt(0) - 32)) + string.substring(1); }
From source file:Main.java
public static String computePhraseShape(String x) { StringBuilder buf = new StringBuilder(); char lastc = 0; for (int i = 0; i < x.length(); i++) { char c = x.charAt(i); if (Character.isDigit(c)) c = '0'; else if (Character.isLetter(c)) c = Character.isLowerCase(c) ? 'a' : 'A'; else if (Character.isWhitespace(c) || Character.isSpaceChar(c)) c = ' '; if (c != lastc) buf.append(c);//from w ww . j ava 2 s . c o m lastc = c; } return buf.toString(); }
From source file:Main.java
public static String camelCaseToDash(String string) { StringBuilder sb = new StringBuilder(2 * string.length()); boolean prevLowerCase = false, prevIsAlpha = false; for (int i = 0; i < string.length(); ++i) { boolean nextLowerCase = i < string.length() - 1 ? Character.isLowerCase(string.charAt(i + 1)) : false; char c = string.charAt(i); if (Character.isUpperCase(c)) { if ((prevLowerCase || nextLowerCase) && prevIsAlpha) sb.append('-'); sb.append(String.valueOf(c).toLowerCase(Locale.ENGLISH)); } else if (c == '.') { sb.append('-'); } else {/*from w w w.ja v a 2 s .c o m*/ sb.append(c); } prevLowerCase = Character.isLowerCase(c); prevIsAlpha = Character.isAlphabetic(c); } return sb.toString(); }
From source file:Main.java
private static String addSpaceIfRequired(String value, int index) { if (index == 0) return VOID_STRING; char precedingChar = value.charAt(index - 1); char thisChar = value.charAt(index); if (Character.isLowerCase(precedingChar) && Character.isUpperCase(thisChar) || Character.isLetter(precedingChar) && Character.isDigit(thisChar) || Character.isDigit(precedingChar) && Character.isLetter(thisChar)) { return SPACE; }/*from www . ja va 2 s .co m*/ if (index + 1 == value.length()) return VOID_STRING; char nextChar = value.charAt(index + 1); if (Character.isUpperCase(precedingChar) && Character.isUpperCase(thisChar) && Character.isLowerCase(nextChar)) { return SPACE; } return VOID_STRING; }
From source file:Main.java
/** * @brief Converting the url to lower case. * /*from www .j a va 2 s .com*/ * @param strUrl [IN] url path * * @return Return modificated url string */ public static String fixUrl(String inUrl) { if (inUrl == null) { return null; } int colon = inUrl.indexOf(':'); boolean allLower = true; if (colon == -1) { inUrl = "http://" + inUrl; } for (int index = 0; index < colon; index++) { char ch = inUrl.charAt(index); if (!Character.isLetter(ch)) { break; } allLower &= Character.isLowerCase(ch); if (index == colon - 1 && !allLower) { inUrl = inUrl.substring(0, colon).toLowerCase() + inUrl.substring(colon); } } if (inUrl.startsWith("http://") || inUrl.startsWith("https://")) return inUrl; if (inUrl.startsWith("http:") || inUrl.startsWith("https:")) { if (inUrl.startsWith("http:/") || inUrl.startsWith("https:/")) { inUrl = inUrl.replaceFirst("/", "//"); } else inUrl = inUrl.replaceFirst(":", "://"); } return inUrl; }
From source file:Main.java
private static boolean isUpperCase(CharSequence sequence) { for (int i = 0; i < sequence.length(); i++) { if (Character.isLowerCase(sequence.charAt(i))) return false; }//from w ww . j a v a2 s . c om return true; }
From source file:Main.java
public static String matchCamelCase(String query, String str) { if (!query.matches("[A-Za-z\\*]+")) { return null; }//from ww w . j a v a 2 s. c om String head = ""; int i; for (i = 0; i < query.length(); i++) { char charI = query.charAt(i); if (Character.isLowerCase(charI)) { head += charI; } else { break; } } if (i > 0) { head += "[^A-Z]*"; } String tail = query.substring(i); String re = "\\b("; tail = tail.replaceAll("\\*", ".*?"); re += head + tail.replaceAll("([A-Z][^A-Z]*)", "$1[^A-Z]*"); re += ".*?)\\b"; Pattern regex = Pattern.compile(re); Matcher m = regex.matcher(str); if (m.find()) { return m.group(); } else { return null; } }