Split string into individual words Java

后端 未结 12 1264
既然无缘
既然无缘 2020-12-02 13:19

I would like to know how to split up a large string into a series of smaller strings or words. For example:

I want to walk my dog.

12条回答
  •  自闭症患者
    2020-12-02 13:42

    You can use split(" ") method of the String class and can get each word as code given below:

    String s = "I want to walk my dog";
    String []strArray=s.split(" ");
    for(int i=0; i

提交回复
热议问题