newText=theText.replace('\n', ' ');//单引号里面至少需要一个空格,或者其他字符 newText = theText.replaceAll("\n", "");后面双引号可以不包括任何内容
注意原来的字符串不会改变