如果你的数据里面有
\n
或者诸如此类的字符或字符串想替换掉
用String.replaceAll
就可以了String text = jTextPane1.getText();
text = text.replaceAll( "\n", " " );其他的替换于此相差不远

解决方案 »

  1.   

    replaceAll( "\n", " " );我昨天写过了,试了一下不行
    我的代码:
    String text = jTextPane1.getText();
    text = text.replaceAll( "\n", " " );
    System.out.println(text);
    eclipse编译
    输入
    acbdefg
    aaaaaa
    bbbbbb
    ccccccc 
    输出:
    acbdefg
     aaaaaa
     bbbbbb
     ccccccc 
      

  2.   

    试试text = text.replace( 13, " " );
      

  3.   

    我觉得要分两次,
    text = text.replaceAll( "\r", "" );
    text = text.replaceAll( "\n", " " );
      

  4.   

    newman0708(nch) ( ) 说对了感谢您回答  symbol68688 (幻影s)  的帖子