Java - Write code to seperate a string On Comma

Requirements

Write code to seperate a string On Comma

Demo

//package com.book2s;

public class Main {
    public static void main(String[] argv) {
        String string = "a,b,c";
        System.out.println(java.util.Arrays
                .toString(seperateOnComma(string)));
    }/*www .j a  va 2s.c  o  m*/

    private static String[] seperateOnComma(String string) {
        string = string.replaceAll("\\s+", "");
        string = string.trim();

        String[] stringArray = string.split(",", -1);
        return stringArray;
    }
}