Java MessageFormat.format格式化字符串大括号以及单引号问题
来源:互联网 发布:阅读软件 编辑:程序博客网 时间:2024/05/21 15:40
在MessageFormat.format方法中组装jason数据字符串:{code:"w1",des:"w2"},起止分别有左大括号和右大括号。方法是将单引号把大括号包含起来。如下:
System.out.println(MessageFormat.format(responseTemplate, "w1","w2"));
如果格式化字符串中包含单引号,处理方法是用2个单引号进行转义:
String responseTemplate = "'{'code:''{0}'',des:''{1}'''}'";
System.out.println(MessageFormat.format(responseTemplate, "w1","w2"));
处理结果:{code:'w1',des:'w2'}
- Java MessageFormat.format格式化字符串大括号以及单引号问题
- Java MessageFormat.format格式化字符串大括号以及单引号问题
- Java MessageFormat.format 特殊符号、单引号
- JAVA字符串格式化-String.format()和MessageFormat的使用
- String.Format 源字符串包含大括号的小问题
- String.Format 源字符串包含大括号的小问题
- MessageFormat类:快速格式化字符串
- MessageFormat对象实现格式化字符串输出,类似C#中的string.format方法
- MessageFormat对象实现格式化字符串输出,类似C#中的string.format方法
- Java 中 MessageFormat.format 用法
- Java MessageFormat.format的用法
- Java MessageFormat.format和ChoiceFormat
- java.text.MessageFormat.format使用
- Java 中 MessageFormat.format 用法
- java的格式化字符串 Format
- java String.format() 字符串格式化
- JAVA字符串格式化String.format( )
- java字符串格式化String.format()
- PacketiX VPN 配置
- CSDN精选Android开发博客
- 谷歌史上10大发明精英 个人最多拥有专利超过80
- GDB多进程调试(转)
- CSDN精选iPhone开发博客
- Java MessageFormat.format格式化字符串大括号以及单引号问题
- linux下的C语言开发(信号处理)
- 网页显示特殊字符
- pcie 驱动卸载 蓝屏
- Google主页设计专利
- 分享C语言中的unsigned类型的一道题目
- Android 4.0设计规范 优先导读 十大改变
- mysql中文排序(utf-8字符集)
- git使用总结