转换 MS 单词“卷曲"引号和撇号 [英] Converting MS word "curly" quotes and apostrophes

查看:16
本文介绍了转换 MS 单词“卷曲"引号和撇号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 Java 中将 MS Word 引号和撇号转换为常规引号和撇号字符?这些字符的 unicode 编号是多少?

How do I convert the MS Word quotes and apostrophes to regular quotes and apostrophes characters in Java? What's the unicode number for these characters?

你好吗?"

‘你好’

由于 Stack Overflow 自动修复它们,以下是它们在编辑器中的显示方式

Since Stack Overflow autofixes them, here's how they appear in an editor

你好吗?"

'你好'

推荐答案

离开 Thomas 的回答,代码是:

Going off Thomas's answer, the code is:

return text.replaceAll("[\u2018\u2019]", "'")
           .replaceAll("[\u201C\u201D]", """);

这篇关于转换 MS 单词“卷曲"引号和撇号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆