Here you can find the source of splitDomains(String domains)
private static String[] splitDomains(String domains)
//package com.java2s; import java.util.ArrayList; public class Main { private static String[] splitDomains(String domains) { ArrayList<String> list = new ArrayList<String>(); int count = domains.length(); int start = -1; for (int i = 0; i < count; ++i) { char c = domains.charAt(i); switch (c) { case '(': // Ignore attribute domains such as "a(props new)". if (i == 0 || domains.charAt(i - 1) != 'a') { start = i;/*from w ww.j a v a2 s .c o m*/ } break; case ')': if (start >= 0) { if (i - start > 1) { list.add(domains.substring(start, i + 1)); } start = -1; } break; } } String[] parts = new String[list.size()]; list.toArray(parts); return parts; } }