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

com.jdroid.gradle.commons.utils.StringUtils Maven / Gradle / Ivy

There is a newer version: 0.18.0
Show newest version
package com.jdroid.gradle.commons.utils;

import com.jdroid.java.collections.Lists;

import java.util.Collection;
import java.util.List;

/**
 * This class contains functions for managing Strings
 */
public abstract class StringUtils {
	
	public final static String EMPTY = "";
	public final static String COMMA = ",";
	public final static String SPACE = " ";

	public static Boolean isEmpty(String text) {
		return text != null ? text.length() == 0 : true;
	}
	
	public static Boolean isNotEmpty(String text) {
		return !isEmpty(text);
	}
	
	public static List splitToListWithCommaSeparator(String text) {
		return Lists.newArrayList(splitToCollection(text, COMMA));
	}

	public static Collection splitToCollection(String text, String separator) {
		Collection values = Lists.newArrayList();
		if (isNotEmpty(text)) {
			values = Lists.newArrayList(text.split(separator));
		}
		return values;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy