Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jan 30th, 2007, 11:08 AM   #1
Riddick
Newbie
 
Join Date: Sep 2006
Posts: 14
Rep Power: 0 Riddick is on a distinguished road
JTextPane: omitting new line (\n) character

Hi i have some code that searches elements of a jtextpane from one element to another looking for key words. However when i get a new keyword from a new line, a new line character proceeds it.

At least i assume that's what happened because I concatenated my keywork with a proceeding 'before' and preceeding 'after' and it came out like this

before
forafter

instead of beforeforafter

is there any way to check and remove the new line character from the keyword or any way to prevent it happening.

Thanks.
Riddick is offline   Reply With Quote
Old Jan 30th, 2007, 3:13 PM   #2
titaniumdecoy
Expert Programmer
 
titaniumdecoy's Avatar
 
Join Date: Nov 2005
Posts: 843
Rep Power: 3 titaniumdecoy is on a distinguished road
Send a message via AIM to titaniumdecoy
str = str.replaceAll("\\s", "");
titaniumdecoy is offline   Reply With Quote
Old Jan 30th, 2007, 3:42 PM   #3
Riddick
Newbie
 
Join Date: Sep 2006
Posts: 14
Rep Power: 0 Riddick is on a distinguished road
Thanks for the answer i'll give it a try. Do you know if it will affect the way the document is saved and read back to the jtextpane?
Riddick is offline   Reply With Quote
Old Feb 22nd, 2007, 3:32 PM   #4
hoffmandirt
Hobbyist Programmer
 
hoffmandirt's Avatar
 
Join Date: Jul 2005
Location: PA
Posts: 125
Rep Power: 4 hoffmandirt is on a distinguished road
Send a message via AIM to hoffmandirt
If you perform the replace on the text inside the JTextPane, it will affect the way it is saved. An idea might be to keep an original copy of the text and create another copy to perform your string operations on.
hoffmandirt is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Ackerman's function - crash upon launch codylee270 C++ 6 Oct 19th, 2006 2:14 AM
New programming challenge DaWei Other Programming Languages 20 Jul 8th, 2006 11:23 AM
Help in QBASIC (I think it's similar to VB) phoenix987 Visual Basic 3 May 9th, 2005 12:33 PM
Help with a QBASIC program phoenix987 Other Programming Languages 4 May 5th, 2005 12:27 PM
Installing IPB 2.03 bh4575 Other Web Development Languages 0 Apr 23rd, 2005 2:36 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 6:12 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC