JSON中getString() 和optString()
来源:互联网 发布:做编程一月工资多少钱 编辑:程序博客网 时间:2024/04/23 18:12
The difference is that optString
returns the empty string (""
) if the key you specify doesn't exist.getString
on the other hand throws a JSONException
. Use getString
if it's an error for the data to be missing, or optString
if you're not sure if it will be there.
optString和getString的区别是,如果你需要的String 特殊字不存在的话,optString会返回一个“”;而getString则会抛出异常;所以如果在你不确定的情况下尽量使用optString,因为这时候使用getString需要你确定data已经丢失;
0 0
- JSON中getString() 和optString()
- JSON中getString() 和optString()
- Json中optString和getString的区别
- JSON中optString和getString的区别
- JSON中optString和getString的区别
- JSON中optString()和getString()区别
- JSON中optString和getString的区别
- 关于JSON中optString和getString的区别
- optString和getString区别
- 安卓解析中JSON中getString() 和optString()的区别
- JSONobject.getString()和JSONobject.optString()
- JSONObject中optString和getString等的区别
- JSONObject的getString()和optString()的区别
- jsonObject.getString() 和jsonObject.optString()区别
- JSONObject optString与getString
- JSONObject optString与getString
- getString和optString的区别(补充toString和valueOf)
- JsonObject的optString()和getString()的区别
- 关于51CTO被脱裤,几点关于密码的建议
- 重写equals()时要重写hashCode()
- 形如数组1223打印所有不同的组合排列java
- PHP 表单提交相关注意事项及错误攻略
- Java 调用MySQL存储过程
- JSON中getString() 和optString()
- hdu 4908 BestCoder Sequence
- 求最大公约数最小公倍数
- jffs2移植卡死kernel panic - not syncing: No init found.处理
- UVA 1025 A Spy in the Metro(DP)
- C++ iostream
- (工具类)使用UltraEdit与虚拟机上的Linux进行ftp连接
- Linux设备驱动之Ioctl控制
- Java基础知识总结1