View Javadoc
1   package org.argeo.connect.util;
2   
3   public class ConnectUtils {
4   
5   	/** Checks whether a string is neither null nor empty */
6   	public static boolean notEmpty(String stringToTest) {
7   		return !isEmpty(stringToTest);
8   	}
9   
10  	/** Checks whether a string is null or empty */
11  	public static boolean isEmpty(String stringToTest) {
12  		return stringToTest == null || "".equals(stringToTest.trim());
13  	}
14  
15  	/** Singleton constructor */
16  	private ConnectUtils() {
17  
18  	}
19  
20  	/**
21  	 * Cleans a String by replacing any '&' by its HTML encoding '&' to
22  	 * avoid <code>SAXParseException</code> while rendering HTML with RWT
23  	 */
24  	public static String replaceAmpersand(String value) {
25  		value = value.replaceAll("&(?![#a-zA-Z0-9]+;)", "&#38;");
26  		return value;
27  	}
28  }