List of usage examples for java.lang Character toLowerCase
public static int toLowerCase(int codePoint)
From source file:org.apache.hyracks.data.std.primitive.UTF8StringPointable.java
public static boolean startsWith(UTF8StringPointable src, UTF8StringPointable pattern, boolean ignoreCase) { int utflen1 = src.getUTF8Length(); int utflen2 = pattern.getUTF8Length(); if (utflen2 > utflen1) { return false; }// w ww . j ava 2 s . com int s1Start = src.getMetaDataLength(); int s2Start = pattern.getMetaDataLength(); int c1 = 0; int c2 = 0; while (c1 < utflen1 && c2 < utflen2) { char ch1 = src.charAt(s1Start + c1); char ch2 = pattern.charAt(s2Start + c2); if (ch1 != ch2) { if (!ignoreCase || ignoreCase && Character.toLowerCase(ch1) != Character.toLowerCase(ch2)) { break; } } c1 += src.charSize(s1Start + c1); c2 += pattern.charSize(s2Start + c2); } return (c2 == utflen2); }
From source file:com.ing.connector.util.WStringUtil.java
/** * checkForSpecialWords --> uppercases any appropriate * word phrases */// w w w . ja va2s.c o m private String checkForSpecialWords(String aString) { String lString = aString; int lLength = lString.length(); //************************************************************ //the following logic checks for word phrases 2 char in length //************************************************************ if (lLength >= 2) { String[] lArrayFor2 = new String[(lLength - 1)]; for (int i = 0; i < lLength - 1; i++) { lArrayFor2[i] = lString.substring(i, i + 2); if (lArrayFor2[i].equalsIgnoreCase("MD") || lArrayFor2[i].equalsIgnoreCase("II") || lArrayFor2[i].equalsIgnoreCase("IV")) { char[] lChar2 = lString.toCharArray(); lChar2[i] = Character.toUpperCase(lChar2[i]); lChar2[i + 1] = Character.toUpperCase(lChar2[i + 1]); lString = new String(lChar2); } } } //************************************************************ //the following logic checks for word phrases 3 char in length //************************************************************ if (lLength >= 3) { String[] lArrayFor3 = new String[(lLength - 2)]; for (int i = 0; i < lLength - 2; i++) { lArrayFor3[i] = lString.substring(i, i + 3); if (lArrayFor3[i].equalsIgnoreCase("III") || lArrayFor3[i].equalsIgnoreCase("CPA")) { char[] lChar3 = lString.toCharArray(); lChar3[i] = Character.toUpperCase(lChar3[i]); lChar3[i + 1] = Character.toUpperCase(lChar3[i + 1]); lChar3[i + 2] = Character.toUpperCase(lChar3[i + 2]); lString = new String(lChar3); } } } //************************************************************ //the following logic checks for word phrases 4 char in length //************************************************************ if (lLength >= 4) { String[] lArrayFor4 = new String[(lLength - 3)]; for (int i = 0; i < lLength - 3; i++) { lArrayFor4[i] = lString.substring(i, i + 4); //*** make uppercase if (lArrayFor4[i].equalsIgnoreCase("FLMI") || lArrayFor4[i].equalsIgnoreCase("CLCU")) { char[] lChar4 = lString.toCharArray(); lChar4[i] = Character.toUpperCase(lChar4[i]); lChar4[i + 1] = Character.toUpperCase(lChar4[i + 1]); lChar4[i + 2] = Character.toUpperCase(lChar4[i + 2]); lChar4[i + 3] = Character.toUpperCase(lChar4[i + 3]); lString = new String(lChar4); } //*** make lowercase if (lArrayFor4[i].equalsIgnoreCase(" OR ") || lArrayFor4[i].equalsIgnoreCase(" OF ")) { char[] lChar4 = lString.toCharArray(); lChar4[i + 1] = Character.toLowerCase(lChar4[i + 1]); lChar4[i + 2] = Character.toLowerCase(lChar4[i + 2]); lString = new String(lChar4); } } } //************************************************************ //the following logic checks for word phrases 5 char in length //************************************************************ if (lLength >= 5) { String[] lArrayFor5 = new String[(lLength - 4)]; for (int i = 0; i < lLength - 4; i++) { lArrayFor5[i] = lString.substring(i, i + 5); //*** make lowercase if (lArrayFor5[i].equalsIgnoreCase(" AND ")) { char[] lChar5 = lString.toCharArray(); lChar5[i + 1] = Character.toLowerCase(lChar5[i + 1]); lChar5[i + 2] = Character.toLowerCase(lChar5[i + 2]); lChar5[i + 3] = Character.toLowerCase(lChar5[i + 3]); lString = new String(lChar5); } } } return lString; }
From source file:com.cloudbees.hudson.plugins.folder.ChildNameGeneratorAltTest.java
public static String mangle(String s) { // We force every name to NFD to ensure that the test works irrespective of what the filesystem does s = Normalizer.normalize(s, Normalizer.Form.NFD); String hash = Util.getDigestOf(s); String base = Normalizer.normalize(s, Normalizer.Form.NFD).toLowerCase(Locale.ENGLISH); StringBuilder buf = new StringBuilder(32); for (char c : base.toCharArray()) { if (buf.length() >= 8) break; if (('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z') || ('0' <= c && c <= '9')) { buf.append(Character.toLowerCase(c)); } else {// ww w .j a v a2 s . co m buf.append('_'); } } buf.append('-'); buf.append(hash.substring(0, 23)); return buf.toString(); }
From source file:net.sf.jabref.bst.BibtexCaseChanger.java
private int convertCharIfBraceLevelIsZero(char[] c, int start, StringBuilder sb, FORMAT_MODE format) { int i = start; switch (format) { case TITLE_LOWERS: if ((i == 0) || (prevColon && Character.isWhitespace(c[i - 1]))) { sb.append(c[i]);/*w w w.j a v a 2 s. c o m*/ } else { sb.append(Character.toLowerCase(c[i])); } if (c[i] == ':') { prevColon = true; } else if (!Character.isWhitespace(c[i])) { prevColon = false; } break; case ALL_LOWERS: sb.append(Character.toLowerCase(c[i])); break; case ALL_UPPERS: sb.append(Character.toUpperCase(c[i])); break; default: LOGGER.info("convertCharIfBraceLevelIsZero - Unknown format: " + format); break; } i++; return i; }
From source file:com.isecpartners.gizmo.HttpResponse.java
public void processResponse(InputStream in) throws FailedRequestException { StringBuffer content = new StringBuffer(); DataInputStream inputStream = new DataInputStream(in); ArrayByteList blist = new ArrayByteList(); String header = null;/* w w w . jav a 2s. c o m*/ int contentLength = 0; boolean isChunked = false; String line; try { line = readline(inputStream); while (line != null && !line.equals(ENDL)) { content.append(line); if (line.toUpperCase().contains(CONTENT_LENGTH) && line.toUpperCase().indexOf(CONTENT_LENGTH) == 0) { String value = line.substring(line.indexOf(CONTENT_LENGTH) + CONTENT_LENGTH.length() + 2, line.indexOf('\r')); contentLength = Integer.parseInt(value.trim()); } else if (line.toUpperCase().contains(TRANSFER_ENCODING)) { if (line.toUpperCase() .substring( line.toUpperCase().indexOf(TRANSFER_ENCODING) + "Transfer-Encoding:".length()) .contains("CHUNKED")) { isChunked = true; } } else if (line.toUpperCase().contains(CONTENT_ENCODING)) { String value = line.substring(line.indexOf(CONTENT_ENCODING) + CONTENT_ENCODING.length() + 2, line.indexOf('\r')); value = value.trim(); if (value.toUpperCase().equals("GZIP")) { this.gzip = true; } else if (value.toUpperCase().equals("DEFLATE")) { this.deflate = true; } } line = readline(inputStream); } if (line == null) { GizmoView.log(content.toString()); throw new FailedRequestException(); } content.append("\r\n"); header = content.substring(0, content.indexOf("\r\n")); append(blist, content); if (contentLength != 0) { for (int ii = 0; ii < contentLength; ii++) { blist.add(inputStream.readByte()); } } if (isChunked) { boolean isDone = false; while (!isDone) { byte current = inputStream.readByte(); blist.add(current); int size = 0; while (current != '\n') { if (current != '\r') { size *= 16; if (Character.isLetter((char) current)) { current = (byte) Character.toLowerCase((char) current); } if ((current >= '0') && (current <= '9')) { size += (current - 48); } else if ((current >= 'a') && (current <= 'f')) { size += (10 + current - 97); } } current = inputStream.readByte(); while ((char) current == ' ') { current = inputStream.readByte(); } blist.add(current); } if (size != 0) { for (int ii = 0; ii < size; ii++) { int byte1 = inputStream.readByte(); byte blah = (byte) byte1; blist.add(blah); } blist.add(inputStream.readByte()); blist.add(inputStream.readByte()); } else { byte ch = (byte) inputStream.read(); StringBuffer endstuff = new StringBuffer(); blist.add(ch); endstuff.append((char) ch); while (ch != '\n') { ch = inputStream.readByte(); endstuff.append((char) ch); blist.add(ch); } isDone = true; } } } if (inputStream.available() > 0) { try { while (true) { blist.add(inputStream.readByte()); } } catch (EOFException e) { System.out.println(e); } } } catch (IOException ex) { Logger.getLogger(HttpResponse.class.getName()).log(Level.SEVERE, null, ex); } setBlist(blist); setHeader(header); if (this.gzip) { addContents(unzipData(blist.toArray())); } else if (this.deflate) { addContents(deflateData(blist.toArray())); } else { addContents(content.toString()); } }
From source file:android.support.v7.internal.view.menu.MenuItemImpl.java
@Override public MenuItem setShortcut(char numericChar, char alphaChar) { mShortcutNumericChar = numericChar;/* w ww.ja v a 2 s . c o m*/ mShortcutAlphabeticChar = Character.toLowerCase(alphaChar); mMenu.onItemsChanged(false); return this; }
From source file:org.brushingbits.jnap.persistence.hibernate.DynaQueryBuilder.java
/** * @param propertyName//from w w w.j ava 2s . com * @return */ private String normalizePropertyName(String propertyName) { propertyName = Character.toLowerCase(propertyName.charAt(0)) + propertyName.substring(1); return propertyName; }
From source file:com.cloudbees.hudson.plugins.folder.ChildNameGeneratorRecTest.java
public static String mangle(String s) { String hash = Util.getDigestOf(s); String base = Normalizer.normalize(s, Normalizer.Form.NFD).toLowerCase(Locale.ENGLISH); StringBuilder buf = new StringBuilder(32); for (char c : base.toCharArray()) { if (buf.length() >= 8) break; if (('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z') || ('0' <= c && c <= '9')) { buf.append(Character.toLowerCase(c)); } else {//from w w w. j av a 2 s .com buf.append('_'); } } buf.append('-'); buf.append(hash.substring(0, 23)); return buf.toString(); }
From source file:com.actionbarsherlock.internal.view.menu.MenuItemImpl.java
public MenuItem setAlphabeticShortcut(char alphaChar) { if (mShortcutAlphabeticChar == alphaChar) return this; mShortcutAlphabeticChar = Character.toLowerCase(alphaChar); mMenu.onItemsChanged(false);//from w w w.j ava 2s . com return this; }
From source file:org.ballerinalang.swagger.code.generator.BallerinaConnectorCodeGenerator.java
@Override public String toOperationId(String operationId) { // method name cannot use reserved keyword, e.g. return if (isReservedWord(operationId)) { LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + camelize(sanitizeName("call_" + operationId))); operationId = "call_" + operationId; }// w w w . ja v a 2 s .co m String name = camelize(operationId); return Character.toLowerCase(name.charAt(0)) + name.substring(1); }