java - Trouble replacing return characters in jTextArea -
I have trouble in replacing characters in a JTextArea in Windows 7. I have input text, which for data collection purposes like "" \ r \ n "with a unique string like" #! " Want to change The problem is, I can not seem to get it to change it.
Prior to the problem: Input: I think I should do something really nothing stupid when I use "\ n" instead of "\ r \ n" then it's completely works fine. As I understand it, Rather than searching for only one line terminator, you can search for multiples and change them. / P> You can use regular expressions and Which output ... You should also keep in mind that there is no JTextArea Example text = New JTextArea ("Enter Text", 10,3); <("\ r \ n", "#!");
Change System.out.println (oneLineOfText) >
string oneLineOfText = exampleText.getText ().
text
text everywhere
Output:
Text
Text everywhere
desired output: text #! Text everywhere
\ r \ n a Windows line Terminator is
string # replacement all for example, for example ...
// string text = "This \ r \ n test \ r \ nfor some text"; String text = "this \ n test \ r \ nfor some text"; Println (text); Text = text.restrest ("\ r \ n | \ n", "#!"); Println (text);
This is a test for some text # this for some text! A test #!
\ r \ n line terminator in all text editors / text files, but Java is a very good way of dealing with this Works ...
Comments
Post a Comment