Results 1 to 2 of 2
Thread: splitting paragraph
- 08-11-2012, 07:19 PM #1Member
- Join Date
- Aug 2012
- Rep Power
Being a beginner to JAVA, I am trying to find out a solution for splitting paragraphs in a file, into lines of statements.
Eg:- Paragraph in the given text file "sample" is
"Welcome to programming in JAVA. Java was developed by James Gosling. It is an object oriented language. "
The desired output is
Welcome to programming in JAVA
Java was developed by James Gosling
Java is an object oriented language
Can anyone help me out to find the way of achieving this.
- 08-11-2012, 08:31 PM #2
Re: splitting paragraph
Oh, what you might want to do is parse the text file and dump it's contents into a String variable. Then use something like the replace function in java.lang.String. Check out: String (Java Platform SE 6). The text you might want to replace would be the '. ' (a period and a whitespace) with a '\n' (newline character). Then you can use System.out.println(); to print out the contents of the String and see if it look like your desired output.
Hope this helps.My API:Java Code:
cat > a.out || cat > main.class
- By rajesh76 in forum New To JavaReplies: 3Last Post: 06-03-2011, 02:57 PM
- By sidharth in forum Advanced JavaReplies: 2Last Post: 11-11-2009, 05:56 AM
- By JavaJunkie in forum JavaServer Pages (JSP) and JSTLReplies: 0Last Post: 05-19-2009, 03:02 PM
- By mintu in forum New To JavaReplies: 3Last Post: 02-28-2009, 08:41 AM
- By Java Tip in forum java.awtReplies: 0Last Post: 06-25-2008, 10:36 AM