Split on substring

前端 未结 4 2020
天涯浪人
天涯浪人 2020-12-15 01:15

How would I split a string based on another substring in a simple way?

e.g. split on \"\\r\\n\"

message1\\r\\nmessage2 

=>

4条回答
  •  清歌不尽
    2020-12-15 01:29

    You could search for the next occurence of your substring thats used as split token. Such a method will probably return the index of the next occurence and having this you can split the string yourself.

提交回复
热议问题