'How to get text from TextArea in JavaFX saving line breaks?
I have a TextArea and a few lines of text in it. When I extract String by getText() method what I`m getting is a line of text instead of really written few lines. So what can I do to distinguishevery line in TextArea?
Solution 1:[1]
Use the .replaceAll like this,
//replace the line breaks "\n" with System line separator...
//replace "yourTextAreaVariabe" with your own...
yourTextAreaVariable.getText().replaceAll("\n", System.getProperty("line.separator"));
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Pascal Msoka |