List of usage examples for java.lang Character toLowerCase
public static int toLowerCase(int codePoint)
From source file:jetx.ext.common.StringMethods.java
/** * <p>Swaps the case of a String changing upper and title case to * lower case, and lower case to upper case.</p> * * <ul>/*from w w w . ja v a 2s . co m*/ * <li>Upper case character converts to Lower case</li> * <li>Title case character converts to Lower case</li> * <li>Lower case character converts to Upper case</li> * </ul> * * <p>For a word based algorithm, see {@link org.apache.commons.lang3.text.WordUtils#swapCase(String)}. * A {@code null} input String returns {@code null}.</p> * * <pre> * StringMethods.swapCase(null) = null * StringMethods.swapCase("") = "" * StringMethods.swapCase("The dog has a BONE") = "tHE DOG HAS A bone" * </pre> * * <p>NOTE: This method changed in Lang version 2.0. * It no longer performs a word based algorithm. * If you only use ASCII, you will notice no change. * That functionality is available in org.apache.commons.lang3.text.WordUtils.</p> * * @param str the String to swap case, may be null * @return the changed String, {@code null} if null String input */ public static String swapCase(String str) { if (isEmpty(str)) { return str; } char[] buffer = str.toCharArray(); for (int i = 0; i < buffer.length; i++) { char ch = buffer[i]; if (Character.isUpperCase(ch)) { buffer[i] = Character.toLowerCase(ch); } else if (Character.isTitleCase(ch)) { buffer[i] = Character.toLowerCase(ch); } else if (Character.isLowerCase(ch)) { buffer[i] = Character.toUpperCase(ch); } } return new String(buffer); }
From source file:org.eclipse.php.internal.ui.corext.util.Strings.java
/** * Tests if a char is lower case. Fix for 26529. * //from ww w .j a v a 2s.c o m * @param ch * the char * @return return true if char is lower case */ public static boolean isLowerCase(char ch) { return Character.toLowerCase(ch) == ch; }
From source file:nz.co.senanque.validationengine.ValidationUtils.java
/** * Make the first character lower case and leave the rest alone. * @param name//from w ww . ja v a 2 s. c o m * @return the resulting name */ public static String getFieldNameWithJavaCase(final String name) { return name == null ? null : Character.toLowerCase(name.charAt(0)) + name.substring(1); }
From source file:com.qpark.eip.core.spring.security.EipRoleVoter.java
/** * Get the name of the service out of the channel name. * * @param channelName//from w w w. j a va 2 s .c o m * the channel name. * @return the service name. */ public static String getServiceName(final String channelName) { StringBuffer service = new StringBuffer(); if (channelName.startsWith("eip")) { service.append(Character.toLowerCase(channelName.charAt("eip".length()))); char ch; int l = channelName.length(); for (int i = "eip".length() + 1; i < l; i++) { ch = channelName.charAt(i); if (Character.isUpperCase(ch)) { break; } else { service.append(ch); } } } return service.toString(); }
From source file:org.apdplat.platform.action.ActionSupport.java
protected String getDefaultModelName(Class clazz) { String modelClassName = ReflectionUtils.getSuperClassGenricType(clazz).getSimpleName(); return Character.toLowerCase(modelClassName.charAt(0)) + modelClassName.substring(1); }
From source file:GIST.IzbirkomExtractor.AbbrList.java
/** * Creates a list of all possible expansions of a given streetName. * stretName itself will be the first element of the expansion list. * /* ww w . j av a 2 s.c o m*/ * @param streetName * @return */ public ArrayList<String> createAllExpansions(String streetName) { ArrayList<String> expansions = new ArrayList<String>(); expansions.add(streetName); Matcher mat = getAbbreviationsPattern().matcher(streetName); if (mat.find()) { for (String exp : abbrevs.get(mat.group(1)).getExpansions()) { StringBuffer str = new StringBuffer(mat.replaceFirst(exp)); /* get rid of abbreviations with dash */ if (streetName.length() > mat.start(1) + 1 && streetName.charAt(mat.start(1) + 1) == '-') { str.setCharAt(mat.start(1) + exp.length(), ' '); } if (exp.endsWith("-")) { // support for ?-, ?-, -; remove space, downcase following letter /* skip replacement and the end of string */ if (str.toString().endsWith(exp)) continue; str.delete(mat.start(1) + exp.length() - 1, mat.start(1) + exp.length() + 1); char upcase = str.charAt(mat.start(1) + exp.length() - 1); str.setCharAt(mat.start(1) + exp.length() - 1, Character.toLowerCase(upcase)); } expansions.add(str.toString()); } } return expansions; }
From source file:com.subgraph.vega.ui.httpviewer.HttpMessageDocumentFactory.java
private boolean isHex(char c) { return (HEX_DIGITS.indexOf(Character.toLowerCase(c)) != -1); }
From source file:org.apdplat.superword.tools.WordLinker.java
public static String linkTo(String word, String emphasize, String emPre, String emSuf, String webSite) { StringBuilder p = new StringBuilder(); for (char c : emphasize.toCharArray()) { p.append("[").append(Character.toUpperCase(c)).append(Character.toLowerCase(c)).append("]{1}"); }/*from w ww .j a v a 2s . com*/ Pattern pattern = Pattern.compile(p.toString()); StringBuilder html = new StringBuilder(); html.append("<a target=\"_blank\" href=\"").append(webSite).append(word).append("\">"); if (StringUtils.isNotBlank(emphasize)) { Set<String> targets = new HashSet<>(); Matcher matcher = pattern.matcher(word); while (matcher.find()) { String target = matcher.group(); targets.add(target); } for (String target : targets) { word = word.replaceAll(target, emPre + target + emSuf); } } html.append(word).append("</a>"); return html.toString(); }
From source file:com.wavemaker.commons.util.StringUtils.java
/** * Converts the given snake case string to Java Field name. * * eg://from w ww .j a v a2s . com * User -> user * User_id -> userId * user_id -> userId * USER_ID -> userId * * @param inputString string to convert * @return java field identifier */ public static String toFieldName(String inputString) { if (inputString == null || inputString.isEmpty()) { return inputString; } String result = ""; char firstChar = inputString.charAt(0); char firstCharToUpperCase = Character.toLowerCase(firstChar); result += firstCharToUpperCase; for (int i = 1; i < inputString.length(); i++) { char currentChar = inputString.charAt(i); if (currentChar != '_') { char previousChar = inputString.charAt(i - 1); if (previousChar == '_') { char currentCharToUpperCase = Character.toUpperCase(currentChar); result += currentCharToUpperCase; } else { char currentCharToLowerCase = Character.toLowerCase(currentChar); result += currentCharToLowerCase; } } } return result; }
From source file:com.netflix.spinnaker.halyard.deploy.deployment.v1.OrcaRunner.java
private static String unCapitalize(String word) { if (word.length() == 0) { return word; }//from w ww .jav a2 s .c o m char first = word.toCharArray()[0]; return Character.toLowerCase(first) + word.substring(1); }