StringUtils: split(String str, String separatorChars) : StringUtils « org.apache.commons.lang « Java by API






StringUtils: split(String str, String separatorChars)

/*
0) AB
1) CD
2) EF
3) GH
 * */
import org.apache.commons.lang.StringUtils;

public class SplitString {
    public static void main(String[] args) {
        //Split a String into an Array using # as seperator.
        String [] splitArr=StringUtils.split("AB#CD#EF#GH", "#");
        
        for(int i=0; i<splitArr.length; i++ ) {
            System.out.println( i + ") "+ splitArr[i]);
        }
    }
}

           
       








Apache-Common-Lang.zip( 248 k)

Related examples in the same category

1.StringUtils: abbreviate(String str, int len)
2.StringUtils: chomp(String str, String separator)
3.StringUtils: containsNone(String str, String invalidChars)
4.StringUtils: containsOnly(String str, String validChars)
5.StringUtils: defaultString(String str)
6.StringUtils: equals(String arg0, String arg1)
7.StringUtils: indexOfDifference(String str1, String str2)
8.StringUtils: join(Object[] array, String separator)
9.StringUtils: reverse(String str)
10.StringUtils: stripToEmpty(String str)
11.StringUtils: substring(String str, int start, int end)
12.StringUtils: trim(String str)
13.StringUtils: trimToEmpty(String str)