How to split the text in to sentence based on set of characters as delimiter ?.
I have a function where user will input text and the delimiter. Delimiter can be single character or a string (user can specify 'xyz' as a delimiter).
I have tried
StringTokenizer(text, delimiter)
which takes only character as delimiter. Next option was
String.split()
but this fails when I give delimiter such as '**'. It requires "\" to be appended to the delimiter.
Appending "\" looks like very tedious job because if the delimiter is "**" then I have to change it to "\*\*". If the delimiter is say "< TAB >" then I split function looks like String [] sentences = text.split("\\<TAB\\>");
Is there any easy way to split text in to sentences based of set of characters as delimiter ?.