我有一个TextArea和其中的几行文字。当我通过getText()方法提取String时,得到的是一行文本,而不是实际写的几行。那么我该如何区分TextArea中的每一行?
最佳答案
像这样使用.replaceAll,
//replace the line breaks "\n" with System line separator...
//replace "yourTextAreaVariabe" with your own...
yourTextAreaVariable.getText().replaceAll("\n", System.getProperty("line.separator"));
关于java - 如何在JavaFX保存换行符中从TextArea获取文本?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/41664796/