package speiger.src.coreengine.rendering.guiOld.helper;

import java.util.function.Predicate;

public class TextFilter
{
	public static final Predicate<String> INTEGER_ONLY = T -> {
		try {
			if(T == null || T.isEmpty());
			else if(T.length() == 1 && T.charAt(0) == '-');
			else Integer.parseInt(T);
			return true;
		}
		catch(Exception e) { return false; }
	};
	
	public static final Predicate<String> FLOAT_ONLY = T -> {
		try {
			if(T == null || T.isEmpty());
			else if(T.length() == 1 && T.charAt(0) == '-');
			else Float.parseFloat(T);
			return true;
		}
		catch(Exception e) { return false; }
	};
}