Commit a693da1f authored by Christian P. MOMON's avatar Christian P. MOMON
Browse files

Added containsAny and containsAnyIgnoreCase method and tests.

parent 03ca464d
......@@ -104,6 +104,44 @@ public class StringsUtils
return result;
}
/**
* Contains any.
*
* @param token
* the token
* @param strings
* the strings
* @return true, if successful
*/
public static boolean containsAny(final String token, final String... strings)
{
boolean result;
result = new StringList(strings).contains(token);
//
return result;
}
/**
* Contains any ignore case.
*
* @param token
* the token
* @param strings
* the strings
* @return true, if successful
*/
public static boolean containsAnyIgnoreCase(final String token, final String... strings)
{
boolean result;
result = new StringList(strings).containsIgnoreCase(token);
//
return result;
}
/**
* Contains blank.
*
......
......@@ -47,6 +47,27 @@ public class StringsUtilsTest
Logger.getRootLogger().setLevel(Level.ERROR);
}
/**
* Test contains any 01.
*/
@Test
public void testContainsAny01()
{
Assert.assertTrue(StringsUtils.containsAny("abc", "aaa", "bbb", "abc"));
Assert.assertFalse(StringsUtils.containsAny("abc", "aaa", "bbb", "aBc"));
}
/**
* Test contains any ignore case 01.
*/
@Test
public void testContainsAnyIgnoreCase01()
{
Assert.assertTrue(StringsUtils.containsAnyIgnoreCase("abc", "aaa", "bbb", "abc"));
Assert.assertTrue(StringsUtils.containsAnyIgnoreCase("abc", "aaa", "bbb", "aBc"));
Assert.assertFalse(StringsUtils.containsAnyIgnoreCase("abc", "aaa", "bbb", "ccc"));
}
/**
* Test contains blank 01.
*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment