java - String Tokenizer separation -
I want to know how we can separate the words of a sentence where the delimiter "space" or " is? 'Or'. '
Input
Input: This is a STRING program. Is it easy? Yes, IS
.
Output:
This is an ARM program. It's easy to have a
Look at the constructor In class there is a provision for accepting a custom delimiter in Java.
Try it:
stringtochnizer tokenizer = new string-locator ("This is a STRING program. Is it easy? Yes, IT", ".?"); While (tokenizer.hasMoreElements ()) {System.out.println (tokenizer.nextElement ()); }
Comments
Post a Comment