Java: How to split a string by a number of characters?

前端 未结 11 1443
夕颜
夕颜 2020-11-27 06:59

I tried to search online to solve this question but I didn\'t found anything.

I wrote the following abstract code to explain what I\'m asking:

String         


        
11条回答
  •  孤城傲影
    2020-11-27 07:17

    Try this

     String text = "how are you?";
        String array[] = text.split(" ");
    

    Or you can use it below

    List list= new ArrayList();
    int index = 0;
    while (index

提交回复
热议问题