Hire QA – Specialized in QA Recruitment, Technical Interviews and Testing Solutions

How to Split String in java?

Category: Java

// Java program to demonstrate working of split(regex, limit) with small limit.

publicclassGFG {

    // Main driver method

    publicstaticvoidmain(String args[])

    {

        // Custom input string

        String str = "geekss@for@geekss";

        String[] arrOfStr = str.split("@", 2);

        for(String a : arrOfStr)

            System.out.println(a);

    }

}

Leave a Reply

Your email address will not be published. Required fields are marked *