public static boolean isNotBlank(String val) { return !isBlank(val); }
/** * Throws {@link NullPointerException} if the parameter <code>o</code> is * <code>null</code>. * * @param o * check if the object is <code>null</code>. * @param param * name of the parameter to check for <code>null</code>. * @throws NullPointerException * if <code>o</code> is <code>null</code> and constructs a * message with the name of the parameter. */ public static void nullCheck(Object o, String param) { assert StringUtil.isNotBlank(param); if (o == null) { throw new NullPointerException(String.format(NULL_FORMAT, param)); } }
/** * Return the string of digits from string. * * @param str Source string to search. * @param idx Start index from which to search. */ public static String subDigitString(final String str, final int idx) { String ret = null; final int sidx = indexOfDigit(str, idx); if (sidx != -1) { final int eidx = indexOfNonDigit(str, sidx); ret = (eidx == -1) ? str.substring(sidx) : str.substring(sidx, eidx); } return ret; }
/** * Throws {@link IllegalArgumentException} if the parameter <code>o</code> * is <code>null</code> or blank. * * @param o * value to test for blank. * @param param * name of the parameter to check. */ public static void blankCheck(String o, String param) { assert StringUtil.isNotBlank(param); if (StringUtil.isBlank(o)) { throw new IllegalArgumentException(String.format(BLANK_FORMAT, param)); } }
assert isNotBlank(line); List<String> fields = new ArrayList<String>(); int length = endsWith(line, fsep) ? line.length() - 1 : line.length(); int j = 0; char ch, nextCh; while (j < length) { ch = line.charAt(j); if (isWhitespace(ch)) { if (fieldStarted) { whitespace++;
/** * Determines if a string is not empty. Its the exact opposite for * {@link #isEmpty(String)}. * * @param val * string to evaluate. * @return true if the string is not empty */ public static boolean isNotEmpty(String val) { return !isEmpty(val); }
/** * Finds the index of the first non digit. * * @param str * String to seach for a non digit. * @return -1 if not found otherwise the index. */ public static int indexOfNonDigit(String str) { return indexOfNonDigit(str, 0); }
/** * Finds the index of the first digit. * * @param str * String to seach for a digit. * @return -1 if not found otherwise the index. */ public static int indexOfDigit(String str) { return indexOfDigit(str, 0); }
/** * Tests the {@link StringUtil#isWhitespace(char)} method. */ @Test public void testWhtiespace() { assertTrue(StringUtil.isWhitespace(' ')); assertTrue(StringUtil.isWhitespace('\t')); assertFalse(StringUtil.isWhitespace('\n')); assertFalse(StringUtil.isWhitespace('\r')); for (char i = 'a'; i < 'Z'; i++) { assertFalse(StringUtil.isWhitespace(i)); } }
/** * Throws {@link IllegalArgumentException} if the parameter <code>o</code> * is <code>null</code> or blank. * * @param o * value to test for blank. * @param param * name of the parameter to check. */ public static void blankCheck(final String o, final String param) { assert StringUtil.isNotBlank(param); if (StringUtil.isBlank(o)) { throw new IllegalArgumentException(String.format(BLANK_FORMAT, param)); } }
assert isNotBlank(line); List<String> fields = new ArrayList<String>(); int length = endsWith(line, fsep) ? line.length() - 1 : line.length(); int j = 0; char ch, next_ch; while (j < length) { ch = line.charAt(j); if (isWhitespace(ch)) { if (fieldStarted) { whitespace++;
/** * Determines if a string is not empty. Its the exact opposite for * {@link #isEmpty(String)}. * * @param val string to evaluate. * @return true if the string is not empty */ public static boolean isNotEmpty(final String val) { return !isEmpty(val); }
/** * Finds the index of the first non digit. * * @param str String to search for a non digit. * @return -1 if not found otherwise the index. */ public static int indexOfNonDigit(final String str) { return indexOfNonDigit(str, 0); }
/** * Finds the index of the first digit. * * @param str String to search for a digit. * @return -1 if not found otherwise the index. */ public static int indexOfDigit(final String str) { return indexOfDigit(str, 0); }
/** * Throws an {@link IllegalArgumentException} if the value passed in blank. */ private static String check(String value) { if (StringUtil.isBlank(value)) { throw new IllegalArgumentException("Uid value must not be blank!"); } return value; }
/** * Throws {@link NullPointerException} if the parameter <code>o</code> is * <code>null</code>. * * @param o * check if the object is <code>null</code>. * @param param * name of the parameter to check for <code>null</code>. * @throws NullPointerException * if <code>o</code> is <code>null</code> and constructs a * message with the name of the parameter. */ public static void nullCheck(final Object o, final String param) { assert StringUtil.isNotBlank(param); if (o == null) { throw new NullPointerException(String.format(NULL_FORMAT, param)); } }
/** * Throws {@link IllegalArgumentException} if the parameter <code>o</code> * is <code>null</code> or blank. * * @param o * value to test for blank. * @param param * name of the parameter to check. */ public static void blankCheck(final String o, final String param) { assert StringUtil.isNotBlank(param); if (StringUtil.isBlank(o)) { throw new IllegalArgumentException(String.format(BLANK_FORMAT, param)); } }
assert isNotBlank(line); List<String> fields = new ArrayList<String>(); int length = endsWith(line, fsep) ? line.length() - 1 : line.length(); int j = 0; char ch, nextCh; while (j < length) { ch = line.charAt(j); if (isWhitespace(ch)) { if (fieldStarted) { whitespace++;
/** * Return the string of digits from string. * * @param str Source string to search. * @param idx Start index from which to search. */ public static String subDigitString(final String str, final int idx) { String ret = null; final int sidx = indexOfDigit(str, idx); if (sidx != -1) { final int eidx = indexOfNonDigit(str, sidx); ret = (eidx == -1) ? str.substring(sidx) : str.substring(sidx, eidx); } return ret; }