![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Sep 2006
Posts: 14
Rep Power: 0
![]() |
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. |
|
|
|
|
|
#2 |
|
Expert Programmer
|
str = str.replaceAll("\\s", ""); |
|
|
|
|
|
#3 |
|
Newbie
Join Date: Sep 2006
Posts: 14
Rep Power: 0
![]() |
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?
|
|
|
|
|
|
#4 |
|
Hobbyist Programmer
|
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.
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Ackerman's function - crash upon launch | codylee270 | C++ | 6 | Oct 19th, 2006 3:14 AM |
| New programming challenge | DaWei | Other Programming Languages | 20 | Jul 8th, 2006 12:23 PM |
| Help in QBASIC (I think it's similar to VB) | phoenix987 | Visual Basic | 3 | May 9th, 2005 1:33 PM |
| Help with a QBASIC program | phoenix987 | Other Programming Languages | 4 | May 5th, 2005 1:27 PM |
| Installing IPB 2.03 | bh4575 | Other Web Development Languages | 0 | Apr 23rd, 2005 3:36 AM |