---
title: "怎么把从数据库里读出来的字符串中的换行符替换成空格"
author: "hbldw521"
date: "2008-12-19T20:24:54Z"
tags: []
categories: ["企业架构"]
slug: "untitled"
draft: false
lastmod: "2008-12-19T20:29:54Z"
id: 297763
url: "https://liudewen.iteye.com/blog/297763"
---

得到的字符串.replaceAll("\r\n","   ").replaceAll("\n","   ")

replaceAll还支持正则表达式：
eg:
replaceAll("\\d"," ") 将所有数字替换成空格.