I have a string "I love A. I hate B". If I split it by using
string.split("\\p{Punct}")
I will get two strings where string1 will be "I love A" and string2 will be "I hate B". Please note that in place of "." I may also have any of the other punctuation characters. How can I recover the exact string as it was before the splitting operation with the correct punctuation character.
Keep a reference to the string - if you can have any punct, you can't guess what you had before
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With