Split on substring

前端 未结 4 1206
一向
一向 2020-12-15 00:58

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:35

    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.

提交回复
热议问题