Extract substring from a string

后端 未结 10 1942
栀梦
栀梦 2020-12-02 19:55

what is the best way to extract a substring from a string in android?

10条回答
  •  半阙折子戏
    2020-12-02 20:22

    There is another way , if you want to get sub string before and after a character

    String s ="123dance456";
    String[] split = s.split("dance");
    String firstSubString = split[0];
    String secondSubString = split[1];
    

    check this post- how to find before and after sub-string in a string

提交回复
热议问题