src/org/ohmage/util/StringUtils.java
public static boolean isMalformedDelimitedList(String string, String delimiter) {
		if(StringUtils.isEmptyOrWhitespaceOnly(string)) {
			return false;
		}
		
		if(StringUtils.isEmptyOrWhitespaceOnly(delimiter)) {
			delimiter = DEFAULT_DELIMITER;
		}
		
		int strlen = string.length();
		int currentIndex = -1;
		for(int i = 0; i < strlen; i++) {
			if(currentIndex == -1) {
				currentIndex = string.indexOf(delimiter);
				if(currentIndex == -1) { // no delimiter found
					return false;
				}
			} else {
				int lastOccurrence = currentIndex;
				currentIndex = string.indexOf(delimiter, lastOccurrence + 1);
				
				if(currentIndex == -1) {
					return false;
				}
				else {
					if(currentIndex == lastOccurrence + 1) { // two delimiters in a row
						return true;
					}
				}
			}
		}
		
		return ! string.equals(delimiter);
	}
/**
	 * Checks the incoming string to see if it contains only the delimiter or
	 * multiple delimiters in a row. If the delimiter is not provided, 
	 * a comma is used.
	 * 
	 * @param string  A string containing a delimited list.
	 * @param delimiter The string delimiter.
	 * @return  true if the string is malformed, false otherwise.
	 */
Checks the incoming string to see if it contains only the delimiter or
multiple delimiters in a row. If the delimiter is not provided,
a comma is used.

@param string  A string containing a delimited list.
@param delimiter The string delimiter.
@return  true if the string is malformed, false otherwise.
Checks the incoming string to see if it contains only the delimiter or multiple delimiters in a row . If the delimiter is not provided a comma is used . @param string A string containing a delimited list . @param delimiter The string delimiter . @return true if the string is malformed false otherwise .
public static boolean isMalformedDelimitedList(String string, String delimiter) {
		if(StringUtils.isEmptyOrWhitespaceOnly(string)) {
			return false;
		}
		if(StringUtils.isEmptyOrWhitespaceOnly(delimiter)) {
			delimiter = DEFAULT_DELIMITER;
		}
		int strlen = string.length();
		int currentIndex = -1;
		for(int i = 0; i < strlen; i++) {
			if(currentIndex == -1) {
				currentIndex = string.indexOf(delimiter);
				if(currentIndex == -1) { 
					return false;
				}
			} else {
				int lastOccurrence = currentIndex;
				currentIndex = string.indexOf(delimiter, lastOccurrence + 1);
				if(currentIndex == -1) {
					return false;
				}
				else {
					if(currentIndex == lastOccurrence + 1) { 
						return true;
					}
				}
			}
		}
		return ! string.equals(delimiter);
	}
public static boolean isMalformedDelimitedList ( String string , String delimiter ) { if ( StringUtils . isEmptyOrWhitespaceOnly ( string ) ) { return false ; } if ( StringUtils . isEmptyOrWhitespaceOnly ( delimiter ) ) { delimiter = DEFAULT_DELIMITER ; } int strlen = string . length ( ) ; int currentIndex = - 1 ; for ( int i = 0 ; i < strlen ; i ++ ) { if ( currentIndex == - 1 ) { currentIndex = string . indexOf ( delimiter ) ; if ( currentIndex == - 1 ) { return false ; } } else { int lastOccurrence = currentIndex ; currentIndex = string . indexOf ( delimiter , lastOccurrence + 1 ) ; if ( currentIndex == - 1 ) { return false ; } else { if ( currentIndex == lastOccurrence + 1 ) { return true ; } } } } return ! string . equals ( delimiter ) ; }
Checks the incoming string to see if it contains only the delimiter or
 multiple delimiters in a row.
Checks the incoming string to see if it contains only the delimiter or multiple delimiters in a row .
// no delimiter found // two delimiters in a row