List of usage examples for java.lang String isEmpty
public boolean isEmpty()
From source file:hr.fer.spocc.util.BasePropertyConstants.java
protected static String buildPropertyPrefix(String... parts) { if (parts == null || parts.length == 0) throw new IllegalArgumentException("Prefix must consist of at least one part"); if (parts.length == 1) return parts[0] + SEPARATOR; StringBuilder sb = new StringBuilder(); for (String part : parts) { if (part.isEmpty()) continue; sb.append(part);//from w w w . ja va 2s .c o m if (!StringBuilderUtils.endsWith(sb, SEPARATOR)) sb.append(SEPARATOR); } if (!StringBuilderUtils.endsWith(sb, SEPARATOR)) sb.append(SEPARATOR); return sb.toString(); }
From source file:Main.java
public static boolean isInputEmpty(String stringToCheck) { stringToCheck = stringToCheck.replaceAll(" ", ""); stringToCheck = stringToCheck.replaceAll("\n", ""); return stringToCheck.isEmpty(); }
From source file:Main.java
private static Vector<String> getTag(String source, String tag) { Vector<String> sTag = new Vector<String>(); if (source == null || source.isEmpty() || tag == null || tag.isEmpty()) return sTag; String subString, sTemp;/* www . j a v a 2s . com*/ int start, end; subString = source; sTemp = "<" + tag; start = subString.indexOf(sTemp); while (start >= 0) { subString = subString.substring(start); sTemp = "</" + tag + ">"; end = subString.indexOf(sTemp); if (end < 0) break; end += sTemp.length(); sTag.add(subString.substring(0, end)); subString = subString.substring(end); sTemp = "<" + tag; start = subString.indexOf(sTemp); } return sTag; }
From source file:com.evolveum.midpoint.common.policy.StringPolicyUtils.java
/** * Convert string to array // w w w . j ava2s .co m * @param in * @return ArrayList */ public static ArrayList<String> stringTokenizer(String in) { ArrayList<String> l = new ArrayList<String>(); for (String a : in.split("")) { if (!a.isEmpty()) { l.add(a); } } return l; }
From source file:Main.java
public static boolean containsOnly(String stringToMatch, String... candidates) { String left = stringToMatch; for (final String candidate : candidates) { left = left.replace(candidate, ""); }//from w w w. j a v a2 s . c o m return left.isEmpty(); }
From source file:org.wso2.carbon.dynamic.client.web.proxy.util.DCRProxyUtils.java
private static String getHostName(String host) { if (host != null && !host.isEmpty()) { if (host.contains("https://")) { return host.replace("https://", ""); }/*w w w . j a v a 2 s.c o m*/ } else { throw new IllegalArgumentException("Remote Host parameter must defined in Authenticators.xml."); } return null; }
From source file:cz.cas.lib.proarc.common.config.Catalogs.java
private static boolean isValidProperty(String prefix, String name, String value) { if (value == null || value.isEmpty()) { LOG.log(Level.WARNING, "Missing {0}.{1} property!", new Object[] { prefix, name }); return false; }//from ww w. ja v a 2 s . c o m return true; }
From source file:it.crs4.seal.common.Utils.java
/** * Substitute any characters to be avoided in a file name with '_'. */// ww w . j a v a2s. c o m public static String sanitizeFilename(String name) { if (name.isEmpty()) throw new IllegalArgumentException("Empty file name!"); // replace all non-word characters (a word character is: [a-zA-Z_0-9]) except '.' and '-' return name.replaceAll("[\\W&&[^.-]]", "_"); }
From source file:de.qaware.cloud.deployer.commons.config.util.FileUtil.java
/** * Reads the content of the file with the specified filename into a string. * * @param filename The name of the file whose content will be returned. * @return The content of the file.//w w w .j a v a 2s .com * @throws ResourceConfigException If a problem with the file occurs. */ public static String readFileContent(String filename) throws ResourceConfigException { if (filename == null || filename.isEmpty()) { throw new ResourceConfigException( COMMONS_MESSAGE_BUNDLE.getMessage("DEPLOYER_COMMONS_ERROR_INVALID_FILENAME")); } URL filepath = FileUtil.class.getResource(filename); if (filepath == null) { throw new ResourceConfigException( COMMONS_MESSAGE_BUNDLE.getMessage("DEPLOYER_COMMONS_ERROR_MISSING_FILE", filename)); } File file = new File(filepath.getPath()); return readFileContent(file); }
From source file:com.anhth12.lambda.common.text.TextUtils.java
public static String[] parsePMMLDelimited(String delimited) { // Although you'd think ignoreSurroundingSpaces helps here, won't work with space // delimiter. So manually trim below. String[] rawResult = doParseDelimited(delimited, formatForDelimiter(' ')); List<String> resultList = new ArrayList<>(); for (String raw : rawResult) { if (!raw.isEmpty()) { resultList.add(raw);//from w w w . j a va2 s . c o m } } return resultList.toArray(new String[resultList.size()]); }