List of usage examples for java.lang String toLowerCase
public String toLowerCase()
From source file:Main.java
/** * check if the first String contains the second one (ignore case). * @param s1 full String/*from w w w . j a va 2s . c o m*/ * @param len1 maximum position in String * @param s2 String to search for * @return true if s1 contains s2 in the range 0-len1 */ static boolean wsubstrncase(String s1, int len1, String s2) { return wsubstrn(s1.toLowerCase(), len1, s2.toLowerCase()); }
From source file:Main.java
private static String startXMLFor(String elementName, String argStr) { int tokenIndex = argStr.toLowerCase().indexOf(elementName.toLowerCase()); if (tokenIndex < 1) return null; int startIndex = tokenIndex; while (startIndex >= 0 && argStr.charAt(startIndex) != '<' && (Character.isWhitespace(argStr.charAt(startIndex)) || startIndex == tokenIndex)) { --startIndex;/* w ww. j a v a2 s. co m*/ } // while if (startIndex < 0 || argStr.charAt(startIndex) != '<') return null; if (startIndex == 0) return argStr; return argStr.substring(startIndex); }
From source file:Main.java
/** * @return/*from ww w . j av a2 s .co m*/ * @throws UnsupportedEncodingException */ public static byte[] hex2byte(String s) throws UnsupportedEncodingException { byte[] src = s.toLowerCase().getBytes("UTF-8"); byte[] ret = new byte[src.length / 2]; for (int i = 0; i < src.length; i += 2) { byte hi = src[i]; byte low = src[i + 1]; hi = (byte) ((hi >= 'a' && hi <= 'f') ? 0x0a + (hi - 'a') : hi - '0'); low = (byte) ((low >= 'a' && low <= 'f') ? 0x0a + (low - 'a') : low - '0'); ret[i / 2] = (byte) (hi << 4 | low); } return ret; }
From source file:Main.java
public static String lowerCaseFirst(String string) { if (string.length() < 2) { return string.toLowerCase(); }/* w w w. j a v a2s .co m*/ String first = string.substring(0, 1).toLowerCase(); String end = string.substring(1, string.length()); return first + end; }
From source file:Main.java
public static String textEquals(final String text) { return format("%s = '%s'", translateTextForPath("text()"), text.toLowerCase()); }
From source file:Main.java
/** * Parses a boolean value from a string * @param str// w ww .j av a2 s . c o m * @return boolean **/ public static Boolean parseStringToBoolean(String str) { if (str == null) return (false); str = str.toLowerCase(); return (("true").equals(str)); }
From source file:com.sky8the2flies.KOTH.util.TimeParser.java
private static int parseTime(String time) { time = time.toLowerCase(); String[] split;//from www . j av a 2 s . c o m if (time.contains("w")) { split = time.split("w"); return Integer.parseInt(split[0]) * 604800; } else if (time.contains("d")) { split = time.split("d"); return Integer.parseInt(split[0]) * 86400; } else if (time.contains("h")) { split = time.split("h"); return Integer.parseInt(split[0]) * 3600; } else if (time.contains("m")) { split = time.split("m"); return Integer.parseInt(split[0]) * 60; } else if (time.contains("s")) { split = time.split("s"); return Integer.parseInt(split[0]); } return 0; }
From source file:Main.java
private static boolean shouldStrip(String filename) { Log.d(TAG, "check should strip:" + filename); return !filename.toLowerCase().startsWith("install.txt"); }
From source file:Main.java
private static String toProperCase(String s, boolean firstLetterSmall) { if (firstLetterSmall) { return s.toLowerCase(); }//ww w . j a va2 s.co m return s.substring(0, 1).toUpperCase() + s.substring(1).toLowerCase(); }
From source file:org.zodiark.protocol.ActorValue.java
@JsonCreator public static ActorValue deserialize(String v) { String value = v.toLowerCase(); switch (value) { case "subscriber": return SUBSCRIBER; case "publisher": return PUBLISHER; case "stream_server": return STREAM_SERVER; case "server": return SERVER; case "monitor": return MONITOR; default://w w w . j a v a 2 s . com throw new IllegalStateException("Invalid value " + value); } }