*/
@Validate
public static String[] splitAnchor(@NotNull String text, @NotNull final Iterable<String> delimiters)
{
// parts are stored here
val result = new ReifiedArrayList<String>(String.class);
// process delimiters serially
for (String delim : delimiters)
{
if (isNullOrEmpty(delim))
throw new IllegalArgumentException("A delimiter cannot be null or empty!");
if (!isNullOrEmpty(text))
{
ReifiedList<String> parts = new ReifiedArrayList<String>(split(text, delim));
if (parts.size() >= 2)
{
// store if any found
result.add(parts.get(0));
text = text.substring(parts.get(0).length() + 1);
}
}
}
return result.toArray();
}