List of usage examples for java.lang Character toUpperCase
public static int toUpperCase(int codePoint)
From source file:nz.co.senanque.validationengine.ValidationUtils.java
private static String figureSetter(final String name) { return name == null ? null : "set" + Character.toUpperCase(name.charAt(0)) + name.substring(1); }
From source file:com.googlesource.gerrit.plugins.github.notification.WebhookServlet.java
private String eventClassName(String name) { String[] nameParts = name.split("_"); List<String> classNameParts = Lists.transform(Arrays.asList(nameParts), new Function<String, String>() { @Override//from ww w . ja v a2 s.c o m public String apply(String part) { return Character.toUpperCase(part.charAt(0)) + part.substring(1); } }); return PACKAGE_NAME + "." + Joiner.on("").join(classNameParts) + "Handler"; }
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>// w w w . ja va2 s. com * <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:com.gargoylesoftware.htmlunit.javascript.host.ActiveXObject.java
/** * Adds a specific property to this object. * @param scriptable the scriptable// w w w .java 2s. c o m * @param propertyName the property name * @param isGetter is getter * @param isSetter is setter */ public static void addProperty(final SimpleScriptable scriptable, final String propertyName, final boolean isGetter, final boolean isSetter) { final String initialUpper = Character.toUpperCase(propertyName.charAt(0)) + propertyName.substring(1); String getterName = null; if (isGetter) { getterName = "get" + initialUpper; } String setterName = null; if (isSetter) { setterName = "set" + initialUpper; } addProperty(scriptable, propertyName, getterName, setterName); }
From source file:ListInput.java
public void appendResultSet(ResultSet results, int index, boolean toTitleCase) { textfield.setText(""); DefaultListModel model = new DefaultListModel(); try {//from ww w . ja v a 2s. c om while (results.next()) { String str = results.getString(index); if (toTitleCase) { str = Character.toUpperCase(str.charAt(0)) + str.substring(1); } model.addElement(str); } } catch (SQLException ex) { System.err.println("appendResultSet: " + ex.toString()); } list.setModel(model); if (model.getSize() > 0) list.setSelectedIndex(0); }
From source file:io.tilt.minka.utils.Defaulter.java
/** * Use delims as word beginner mark, remove it and proper case words * Take "HELLO_WORLD" and turn into "helloWorld" * @param s/*from ww w. ja v a 2 s. c o m*/ * @return */ private static String properCaseIt(final String s) { final StringBuilder sb = new StringBuilder(); boolean capit = true; boolean first = true; for (char ch : s.toCharArray()) { ch = capit && !first ? Character.toUpperCase(ch) : Character.toLowerCase(ch); if (DELIMS.indexOf((char) ch) < 0) { sb.append(ch); } first = false; capit = (DELIMS.indexOf((int) ch) >= 0); } return sb.toString(); }
From source file:nz.co.senanque.validationengine.ValidationUtils.java
private static String figureGetter(final String name) { return name == null ? null : "get" + Character.toUpperCase(name.charAt(0)) + name.substring(1); }
From source file:net.sf.ehcache.config.BeanHandler.java
/** * Builds a method name from an element or attribute name. *///from ww w . j a va 2s . c om private static String makeMethodName(final String prefix, final String name) { return prefix + Character.toUpperCase(name.charAt(0)) + name.substring(1); }
From source file:com.netflix.spinnaker.halyard.deploy.deployment.v1.OrcaRunner.java
private static String capitalize(String word) { if (word.length() == 0) { return word; }/*ww w . ja v a2s. c om*/ char first = word.toCharArray()[0]; return Character.toUpperCase(first) + word.substring(1); }