List of usage examples for java.lang Character toLowerCase
public static int toLowerCase(int codePoint)
From source file:com.yunmel.syncretic.utils.commons.StrUtils.java
/** * ??//from w w w . j av a 2s . c om * @param str * @return */ public static String firstCharToLower(String str) { StringBuffer sb = new StringBuffer(str); sb.setCharAt(0, Character.toLowerCase(sb.charAt(0))); return sb.toString(); }
From source file:org.azyva.dragom.util.Util.java
/** * Converts a PascalCase (or camelCase) string to lowercase with dashes. * * @param stringPascalCase See description. * @return See description.//from ww w . ja va 2 s . c om */ public static String convertPascalCaseToLowercaseWithDashes(String stringPascalCase) { StringBuilder stringBuilder; int charCount; stringBuilder = new StringBuilder(); charCount = stringPascalCase.length(); for (int i = 0; i < charCount; i++) { char character = stringPascalCase.charAt(i); if (Character.isUpperCase(character)) { if (i != 0) { stringBuilder.append('-'); } stringBuilder.append(Character.toLowerCase(character)); } else { stringBuilder.append(character); } } return stringBuilder.toString(); }
From source file:datavis.Gui.java
private void updateGraphs_pieChart(DataList dataset, boolean load) { String sItem = "default"; //If you are initially loading the data.. if (load) {/*from w ww . j av a 2 s. c o m*/ sItem = "default"; //Display the default chart } else { //otherwise, display the chart from the drop-down menu selection sItem = jComboBox1.getSelectedItem().toString(); } //modify the string to match what is needed //To select the proper graph sItem = sItem.replaceAll("\\s+", ""); sItem = Character.toLowerCase(sItem.charAt(0)) + (sItem.length() > 1 ? sItem.substring(1) : ""); //Reinit and Add chart to GUI jPanel1.removeAll(); jPanel1.revalidate(); JFreeChart chart = dataset.getPieChartChart(sItem); chart.removeLegend(); javax.swing.JPanel chartPanel = new ChartPanel(chart); chartPanel.setSize(jPanel1.getSize()); jPanel1.add(chartPanel); jPanel1.repaint(); }
From source file:org.diorite.impl.CoreMain.java
public static InitResult init(final OptionSet options, final boolean client) { CoreMain.client = client;//from w w w .j a v a 2 s.co m if (options.has("version")) { return InitResult.VERSION; } if (options.has("?")) { return InitResult.HELP; } final String path = new File(".").getAbsolutePath(); if (path.contains("!") || path.contains("+")) { System.err.println( "Cannot run server in a directory with ! or + in the pathname. Please rename the affected folders and try again."); return InitResult.STOP; } try { CoreMain.enabledDebug = options.has("debug"); CoreMain.debug("===> Debug is enabled! <==="); try { final String lvl = options.valueOf("rld").toString(); if (lvl.length() == 1) { ResourceLeakDetector .setLevel(ResourceLeakDetector.Level.values()[DioriteMathUtils.asInt(lvl, 0)]); } else { ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.valueOf(lvl)); } } catch (final Exception e) { e.printStackTrace(); } if (options.has("noconsole")) { CoreMain.consoleEnabled = false; } int maxPermGen = 0; for (final String s : ManagementFactory.getRuntimeMXBean().getInputArguments()) { if (s.startsWith("-XX:MaxPermSize")) { maxPermGen = DioriteMathUtils.asInt(PERM_GEN_PAT.matcher(s).replaceAll(""), 0); maxPermGen <<= 10 * "kmg".indexOf(Character.toLowerCase(s.charAt(s.length() - 1))); } } if ((Float.parseFloat(System.getProperty("java.class.version")) < JAVA_8) && (maxPermGen < MB_128)) { System.out.println( "Warning, your max perm gen size is not set or less than 128mb. It is recommended you restart Java with the following argument: -XX:MaxPermSize=128M"); } System.out.println("Starting server, please wait..."); registerNbt(); // register all packet classes. RegisterPackets.init(); // TODO: load "magic values" // never remove this line (Material.values), it's needed even if it don't do anything for you. // it will force load all material classes, loading class of one material before "Material" is loaded will throw error. Material.values(); System.out.println("Registered " + Material.getBlockMaterialsCount() + " (" + Material.getAllBlockMaterialsCount() + " with sub-types) diorite blocks."); System.out.println("Registered " + Material.getItemMaterialsCount() + " (" + Material.getAllItemMaterialsCount() + " with sub-types) diorite items."); System.out.println("Registered " + Material.getMaterialsCount() + " (" + Material.getAllMaterialsCount() + " with sub-types) diorite blocks and items."); } catch (final Throwable t) { t.printStackTrace(); } return InitResult.RUN; }
From source file:org.diorite.chat.ChatColor.java
public static String translateAlternateColorCodesInString(final char altColorChar, final String textToTranslate) { final char[] b = textToTranslate.toCharArray(); for (int i = 0; i < (b.length - 1); i++) { if ((b[i] == altColorChar) && ("0123456789AaBbCcDdEeFfKkLlMmNnOoRr".indexOf(b[(i + 1)]) > -1)) { b[i] = COLOR_CHAR;/* w w w . j a v a 2 s .c o m*/ b[(i + 1)] = Character.toLowerCase(b[(i + 1)]); } } return new String(b); }
From source file:com.googlecode.jtiger.modules.ecside.tag.form.ECSideFormTagUtil.java
public static int indexOfIgnoreCase(String src, String subS, int startIndex) { String sub = subS.toLowerCase(); int sublen = sub.length(); int total = src.length() - sublen + 1; for (int i = startIndex; i < total; i++) { int j = 0; while (j < sublen) { char source = Character.toLowerCase(src.charAt(i + j)); if (sub.charAt(j) != source) { break; }//w w w . j a v a2s .c om j++; } if (j == sublen) { return i; } } return -1; }
From source file:UrlEncoder.java
/** * {@inheritDoc}/*from w ww . ja va2s .c om*/ */ public String encode(String text) { if (text == null) return null; if (text.length() == 0) return text; final BitSet safeChars = isSlashEncoded() ? RFC2396_UNRESERVED_CHARACTERS : RFC2396_UNRESERVED_WITH_SLASH_CHARACTERS; final StringBuilder result = new StringBuilder(); final CharacterIterator iter = new StringCharacterIterator(text); for (char c = iter.first(); c != CharacterIterator.DONE; c = iter.next()) { if (safeChars.get(c)) { // Safe character, so just pass through ... result.append(c); } else { // The character is not a safe character, and must be escaped ... result.append(ESCAPE_CHARACTER); result.append(Character.toLowerCase(Character.forDigit(c / 16, 16))); result.append(Character.toLowerCase(Character.forDigit(c % 16, 16))); } } return result.toString(); }
From source file:no.sesat.search.site.config.AbstractDocumentFactory.java
/*** * <p>The words within the bean name are deduced assuming the * first-letter-capital (for example camel's hump) naming convention. For * example, the words in <code>FooBar</code> are <code>foo</code> * and <code>bar</code>.</p> * * <p>Then the {@link #getSeparator} property value is inserted so that it separates * each word.</p>/*from w ww . ja v a 2 s. c om*/ * * @param beanName The name string to convert. If a JavaBean * class name, should included only the last part of the name * rather than the fully qualified name (e.g. FooBar rather than * org.example.FooBar). * @return the bean name converted to either upper or lower case with words separated * by the separator. **/ public static String beanToXmlName(final String beanName) { final StringBuilder xmlName = new StringBuilder(beanName); for (int i = 0; i < xmlName.length(); ++i) { final char c = xmlName.charAt(i); if (Character.isUpperCase(c)) { xmlName.replace(i, i + 1, "-" + Character.toLowerCase(c)); ++i; } } return xmlName.toString(); }
From source file:org.axe.util.StringUtil.java
public static String camelToUnderline(String param) { if (param == null || "".equals(param.trim())) { return ""; }/*from w w w . j a va 2 s .c om*/ int len = param.length(); StringBuilder sb = new StringBuilder(len); for (int i = 0; i < len; i++) { char c = param.charAt(i); if (Character.isUpperCase(c)) { if (i > 0) { sb.append(UNDERLINE); } sb.append(Character.toLowerCase(c)); } else { sb.append(c); } } return sb.toString(); }
From source file:nl.strohalm.cyclos.utils.RequestHelper.java
/** * Store the enum as an array, under the unqualified class name as key (with the first letter lowercased: ex: nl.strohalm...MyEnum = myEnum) *//* w w w. jav a 2 s. c o m*/ public static <E extends Enum<?>> void storeEnum(final HttpServletRequest request, final Class<E> enumType) { String name = ClassHelper.getClassName(enumType); name = Character.toLowerCase(name.charAt(0)) + name.substring(1); storeEnum(request, enumType, name); }