原格式输出表单提交的内容
表单提交过程中,可能里面书写了大量的换位符,如空格,换行,分段等,在写入的数据库的时候,需要简单处理一下,从数据库取出显示的时候才有可能与原输入格式一致。
String content = qForm.getString("content"); content = content.replace("\n\r","
");
content = content.replace("\r","
");
content = content.replace("\t"," ");
question.setContent(content);
String content1 = question.getContent(); content1 = content1.replace("
","\n\r");
content1 = content1.replace("
","\r");
content1 = content1.replace(" ","\t");
question.setContent(content1);
成长的乐趣,在于分享!
|