List of usage examples for java.lang String toUpperCase
public String toUpperCase()
From source file:com.fluidops.iwb.widget.GMapWidget.java
private static int convertLatSpecToSign(String latSpec) { return (latSpec.toUpperCase().charAt(0) == 'S' ? -1 : 1); }
From source file:com.fluidops.iwb.widget.GMapWidget.java
private static int convertLngSpecToSign(String lngSpec) { return (lngSpec.toUpperCase().charAt(0) == 'W' ? -1 : 1); }
From source file:Main.java
License:asdf
public static ArrayList<String> filter(String[] input, String filter, Integer maxlinelength) { init();/* ww w. jav a2s .c om*/ //include both uppercase and lowercase letters in filter //example: asdF becomes asdfASDF filter = filter.toLowerCase() + filter.toUpperCase(); ArrayList<String> array = new ArrayList<String>(); String charstring; String filteredstring = ""; boolean lastwasspace = true; // ensure that text does not begin with a // space Integer counter = 0; for (String s : input) { //terminate with space - add a space between lines s += " "; for (Character c : s.toCharArray()) { charstring = c.toString(); //prevent doublespace; //break lines on spaces, when line meets or exceeds maxlinelength if (c == ' ') { if (lastwasspace) { // ignore double spaces } else { lastwasspace = true; if (filter.contains(charstring)) { filteredstring += " "; } //if filter doesn't contain " ", //we'll add one anyway every few words else { counter++; Log.e("", counter.toString()); if (counter == 4) { counter = 0; filteredstring += " "; Log.e("", "space"); } } // add and reset only if adding the next string will // exceed length limit if (filteredstring.length() >= maxlinelength) { array.add(filteredstring); filteredstring = ""; } } } else if (filter.contains(charstring)) { lastwasspace = false; filteredstring += charstring; if (Character.getNumericValue(c.charValue()) >= 0) chartotals[Character.getNumericValue(c.charValue())]++; } } } array.add(filteredstring); // for (int i = 0; i < chartotals.length; i++) // System.out.println(String.valueOf(i) + " " + chartotals[i]); //calculate total number of letters totalcharcount = 0; for (String s : array) totalcharcount += s.length(); return array; }
From source file:datacite.oai.provider.util.BOMUtil.java
/** * Remove a Byte Order Mark from the beginning of a byte[]. * @param array The byte[] to remove a BOM from. * @param encoding The character encoding to remove the BOM for. * @return The original byte[] without BOM. *//* www .j av a2 s. com*/ public static byte[] removeBOM(byte[] array, String encoding) throws UnsupportedEncodingException { if (encoding == null || encoding.trim().length() == 0) { throw new UnsupportedEncodingException("Unsupported encoding: " + encoding); } else { encoding = encoding.toUpperCase().replaceAll("[^A-Z0-9]", ""); byte[] bom = BOMUtil.BOM_MAP.get(encoding); if (bom == null) { throw new UnsupportedEncodingException("Unsupported encoding: " + encoding); } else { return BOMUtil.removeBOM(array, bom); } } }
From source file:io.trivium.Central.java
public static void setLogLevel(String level) { Logger logger = Logger.getLogger(""); logger.setLevel(Level.parse(level.toUpperCase())); }
From source file:Main.java
/** * @param dom//from ww w . j a va 2 s.c o m * The dom string. * @param pos * Position where to start searching. * @param element * The element. * @return the position where the close element is */ public static int getCloseElementLocation(String dom, int pos, String element) { String[] elements = { "LINK", "META", "INPUT", "BR" }; List<String> singleElements = Arrays.asList(elements); if (singleElements.contains(element.toUpperCase())) { return dom.indexOf('>', pos) + 1; } // make sure not before the node int openElements = 1; int i = 0; int position = pos; String dom_lower = dom.toLowerCase(); String element_lower = element.toLowerCase(); String openElement = "<" + element_lower; String closeElement = "</" + element_lower; while (i < MAX_SEARCH_LOOPS) { if (dom_lower.indexOf(openElement, position) == -1 && dom_lower.indexOf(closeElement, position) == -1) { return -1; } if (dom_lower.indexOf(openElement, position) < dom_lower.indexOf(closeElement, position) && dom_lower.indexOf(openElement, position) != -1) { openElements++; position = dom_lower.indexOf(openElement, position) + 1; } else { openElements--; position = dom_lower.indexOf(closeElement, position) + 1; } if (openElements == 0) { break; } i++; } return position - 1; }
From source file:com.moss.error_reporting.client.ErrorReportProxyFactory.java
private static ProxyFactory create(ProxyProviderOption option, ProxyProviderOption defaultOption) { Log log = LogFactory.getLog(ErrorReportProxyFactory.class); if (option == null) { if (log.isDebugEnabled()) { log.debug(/*from w ww.j a va2s. c om*/ "No option was provided as an argument, attempting to determine option from system property '" + PROXY_PROVIDER_PROPERTY + "'"); } try { String prop = System.getProperty(PROXY_PROVIDER_PROPERTY); if (prop != null) { option = ProxyProviderOption.valueOf(prop.toUpperCase()); if (option == null) { if (log.isDebugEnabled()) { log.debug("Could not determine option from system property '" + PROXY_PROVIDER_PROPERTY + "': " + prop); } } else { if (log.isDebugEnabled()) { log.debug("Determined option from system property '" + PROXY_PROVIDER_PROPERTY + "': " + option); } } } else { if (log.isDebugEnabled()) { log.debug("The system property '" + PROXY_PROVIDER_PROPERTY + "' was not set, cannot use it to determine which option to use."); } } } catch (Exception ex) { log.warn( "Encountered unexpected failure while attempting to determine which option to use from system property '" + PROXY_PROVIDER_PROPERTY + "'", ex); } if (option == null) { if (defaultOption == null) { throw new RuntimeException( "No default option was provided, cannot determine which option to use for supplying the proxy provider."); } else { if (log.isDebugEnabled()) { log.debug("No specific option was chosen, using default option: " + defaultOption); } option = defaultOption; } } } else { if (log.isDebugEnabled()) { log.debug("Option " + option + " was provided as an argument, using it directly."); } } ProxyProvider prov = option.makeProvider(); ProxyFactory factory = new ProxyFactory(prov); return factory; }
From source file:com.moss.error_reporting.server.TestErrorReportProxyFactory.java
private static ProxyFactory create(ProxyProviderOption option, ProxyProviderOption defaultOption) { Log log = LogFactory.getLog(TestErrorReportProxyFactory.class); if (option == null) { if (log.isDebugEnabled()) { log.debug(/*from ww w. j av a 2 s . c om*/ "No option was provided as an argument, attempting to determine option from system property '" + PROXY_PROVIDER_PROPERTY + "'"); } try { String prop = System.getProperty(PROXY_PROVIDER_PROPERTY); if (prop != null) { option = ProxyProviderOption.valueOf(prop.toUpperCase()); if (option == null) { if (log.isDebugEnabled()) { log.debug("Could not determine option from system property '" + PROXY_PROVIDER_PROPERTY + "': " + prop); } } else { if (log.isDebugEnabled()) { log.debug("Determined option from system property '" + PROXY_PROVIDER_PROPERTY + "': " + option); } } } else { if (log.isDebugEnabled()) { log.debug("The system property '" + PROXY_PROVIDER_PROPERTY + "' was not set, cannot use it to determine which option to use."); } } } catch (Exception ex) { log.warn( "Encountered unexpected failure while attempting to determine which option to use from system property '" + PROXY_PROVIDER_PROPERTY + "'", ex); } if (option == null) { if (defaultOption == null) { throw new RuntimeException( "No default option was provided, cannot determine which option to use for supplying the proxy provider."); } else { if (log.isDebugEnabled()) { log.debug("No specific option was chosen, using default option: " + defaultOption); } option = defaultOption; } } } else { if (log.isDebugEnabled()) { log.debug("Option " + option + " was provided as an argument, using it directly."); } } ProxyProvider prov = option.makeProvider(); ProxyFactory factory = new ProxyFactory(prov); return factory; }
From source file:Main.java
public static String getHexStr(byte[] buffer) { String hexStr = ""; if (buffer != null) { for (byte b : buffer) { String temp = Integer.toHexString(b & 0xFF); if (temp.length() == 1) { hexStr += "0"; }/*from w w w .j av a2 s . c o m*/ hexStr += temp + " "; } } return hexStr.toUpperCase(); }
From source file:es.sotileza.plugin.utils.Utilidades.java
public static String calculaTipo(String tipo, Integer tam, Integer scale) { tipo = tipo.toUpperCase(); if (tipo.equals("NUMBER")) { if (scale == null || scale == 0) { if (tam > 10) return "Long"; else if (tam == 1) return "Boolean"; return "Integer"; } else {//from w w w. j ava 2 s . c o m return "Double"; } } else if (tipo.equals("VARCHAR2") || tipo.equals("CLOB")) { return "String"; } else if (tipo.equals("DATE")) { return "Date"; } return null; }