How to split a string with delimiter comma in java

1 Answer

0 votes
import java.util.*;

public class MyClass {
    public static void main(String args[]) {
        String[] strs = "java,php,   c   ,python,,,c#,!".split(",");

        for (String s : strs) {
            System.out.println(s);
        }
    }
}
 


 
/*
run:

java
php
   c   
python


c#
!

*/

 



answered Jun 27, 2019 by avibootz

Related questions

...