Split Java String by New Line

前端 未结 20 1128
予麋鹿
予麋鹿 2020-11-22 00:56

I\'m trying to split text in a JTextArea using a regex to split the String by \\n However, this does not work and I also tried by \\r\\n|\\r|

20条回答
  •  别那么骄傲
    2020-11-22 01:37

    The above code doesnt actually do anything visible - it just calcualtes then dumps the calculation. Is it the code you used, or just an example for this question?

    try doing textAreaDoc.insertString(int, String, AttributeSet) at the end?

提交回复
热议问题