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多行文本框显示内容请搜索靠谱客的其他文章。
发表评论 取消回复