Split strings keeping all trailing empty elements

后端 未结 3 1604
长发绾君心
长发绾君心 2021-01-25 07:28

I am relatively new to java programming. How would you split following lines of Strings separated by semicolons?

String; String; String; String, String; String;;         


        
3条回答
  •  别那么骄傲
    2021-01-25 08:09

    Your answer is in the javadoc.

    String toto = "A;B;C;D";
    
    String[] tokens = toto.split(";");
    

提交回复
热议问题