StringUtils: containsOnly(String str, String validChars)
/*
4) Check if 643287460 contains only 0123456789 >>>true
*/
import org.apache.commons.lang.StringUtils;
public class StringUtilsTrial {
public static void main(String[] args) {
// Check if string contains only a specified set of characters. Return
// boolean
System.out.println("4) Check if 643287460 contains only 0123456789 >>>"
+ StringUtils.containsOnly("643287460", "0123456789"));
}
}
Apache-Common-Lang.zip( 248 k)Related examples in the same category