How to split a sentence into two parts

后端 未结 5 1312
半阙折子戏
半阙折子戏 2021-01-21 20:29

How to split a sentence into two parts in JAVA? If there is the following

String sentence = \"I love Java <=> I love Python\"

How can I

5条回答
  •  心在旅途
    2021-01-21 21:08

    Why not do:

    String[] words = line.split("<=>");
    for(String word : words){
            System.out.println(word); 
    }
    

    Output:

    I love Java

    I love Python

提交回复
热议问题