mirror of
https://github.com/fankes/JSON-java-compat.git
synced 2025-09-06 18:55:30 +08:00
optString
This commit is contained in:
6
JSONArray.java
Executable file → Normal file
6
JSONArray.java
Executable file → Normal file
@@ -76,7 +76,7 @@ import java.util.Map;
|
|||||||
* </ul>
|
* </ul>
|
||||||
|
|
||||||
* @author JSON.org
|
* @author JSON.org
|
||||||
* @version 2011-11-24
|
* @version 2011-12-19
|
||||||
*/
|
*/
|
||||||
public class JSONArray {
|
public class JSONArray {
|
||||||
|
|
||||||
@@ -555,8 +555,8 @@ public class JSONArray {
|
|||||||
public String optString(int index, String defaultValue) {
|
public String optString(int index, String defaultValue) {
|
||||||
Object object = this.opt(index);
|
Object object = this.opt(index);
|
||||||
return JSONObject.NULL.equals(object)
|
return JSONObject.NULL.equals(object)
|
||||||
? object.toString()
|
? defaultValue
|
||||||
: defaultValue;
|
: object.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user