I\'m trying to break up a paragraph into sentences. Here is my code so far:
import java.util.*;
public class StringSplit {
public static void main(String a
The first one is a pretty hard problem to do properly, since you'd have to implement sentence detection. I suggest you don't do that, and just separate sentences with two blank lines after a punctuation mark. For example:
"The outcome of the negotiations is vital, because the current tax levels signed into law by President George W. Bush expire on Dec. 31. Unless Congress acts, tax rates on virtually all Americans who pay income taxes will rise on Jan. 1. That could affect economic growth and even holiday sales."
The second one can be solved using String.trim().
Example:
String one = " and now... ";
String two = one.trim();
System.out.println(two); // output: "and now..."