All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jvnet.jaxb2.maven2.util.StringUtils Maven / Gradle / Ivy

package org.jvnet.jaxb2.maven2.util;



public class StringUtils {

	/**
	 * Checks if a (trimmed) String is null or empty.
	 * 
	 * @param string
	 *            the String to check
	 * @return true if the string is null, or length
	 *         zero once trimmed.
	 */
	public static boolean isEmpty(String string) {
		return (string == null || string.trim().length() == 0);
	}

	public static String escapeSpace(String url) {
		// URLEncoder didn't work.
		StringBuffer buf = new StringBuffer();
		for (int i = 0; i < url.length(); i++) {
			// TODO: not sure if this is the only character that needs to be
			// escaped.
			if (url.charAt(i) == ' ')
				buf.append("%20");
			else
				buf.append(url.charAt(i));
		}
		return buf.toString();
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy