概述
I have a requirement in my project.
I generate a comment string in javascript.
Coping Option: Delete all codes and replace
Source Proj Num: R21AR058864-02
Source PI Last Name: SZALAI
Appl ID: 7924675; File Year: 7924675
I send this to server where I store it as a string in db and then after that I retrieve it back and show it in a textarea.
I generate it in javascript as :
codingHistoryComment += 'Source Proj Num: '+'n';
codingHistoryComment += 'Source PI Last Name: '+'n';
codingHistoryComment += 'Appl ID: ; File Year: '+'n';
In java I am trying to replace the n to
:
String str = soChild2.getChild("codingHistoryComment").getValue().trim();
if(str.contains("\n")){
str = str.replaceAll("(rn|n)", "
");
}
However the textarea still get populated with the "n" characters:
Coping Option: Delete all codes and replacenSource Proj Num: R21AR058864-02nSource PI Last Name: SZALAInAppl ID: 7924675; File Year: 7924675n
Thanks.
解决方案
Here is a test that works, try it out:
String str = "This is a testrn test.";
if(str.contains("rn")) {
System.out.println(str);
}
最后
以上就是健忘茉莉为你收集整理的java多行文本框显示,需要获取多行字符串以在文本框Java中显示的全部内容,希望文章能够帮你解决java多行文本框显示,需要获取多行字符串以在文本框Java中显示所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复