List of usage examples for org.apache.commons.lang StringUtils startsWithAny
public static boolean startsWithAny(String string, String[] searchStrings)
Check if a String starts with any of an array of specified strings.
From source file:org.skb.util.misc.Json2Oat.java
public TSBase read(Scanner input) { String content = new String(); try {// w w w. j av a2 s .c o m while (input.hasNextLine()) { String line = input.nextLine(); if (!StringUtils.startsWithAny(line.trim(), new String[] { "//", "#" })) content += line.trim(); } } catch (Exception e) { System.err.println(e); } return this.s2o(content); }
From source file:org.talend.dataquality.converters.StringTrimmer.java
/** * Remove trailing and leading characters which may be empty string, space string,\t,\n,\r,\f...any space, break related * characters./*from www .j av a 2s . c o m*/ * * @param inputStr - the input text. * @return String */ public String removeTrailingAndLeadingWhitespaces(String inputStr) { if (StringUtils.isEmpty(inputStr)) { return inputStr; } String result = inputStr; while (StringUtils.startsWithAny(result, WHITESPACE_CHARS)) { result = StringUtils.removeStart(result, result.substring(0, 1)); } while (StringUtils.endsWithAny(result, WHITESPACE_CHARS)) { result = StringUtils.removeEnd(result, result.substring(result.length() - 1, result.length())); } return result; }