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

Popular posts from this blog

scala - Play Framework - how to bind form to a session field -

c++ - Why does Visual Studio Release build break on non-executing code line -

Firefox reacting to JQuery setTimeout that doesn't apply -