Processing, 類JSONObject
中的isNull()
用法介紹。
用法
.isNull(key)
參數
key
(String)
一個關鍵字符串。
返回
boolean
說明
確定與鍵關聯的值是否為 null
,即沒有定義的值 ( false
) 或者它是否有值 ( true
)。
例子
JSONObject json;
void setup() {
json = new JSONObject();
json.setInt("id", 0);
json.setString("species", null);
if (json.isNull("species") == true) {
println("The species is undefined");
} else {
println("The ID is " + json.getString("species"));
}
}
相關用法
- Processing JSONObject.setJSONArray()用法及代碼示例
- Processing JSONObject.setString()用法及代碼示例
- Processing JSONObject.setJSONObject()用法及代碼示例
- Processing JSONObject.getString()用法及代碼示例
- Processing JSONObject.getJSONArray()用法及代碼示例
- Processing JSONObject.getJSONObject()用法及代碼示例
- Processing JSONObject.setInt()用法及代碼示例
- Processing JSONObject.getFloat()用法及代碼示例
- Processing JSONObject.setFloat()用法及代碼示例
- Processing JSONObject.getBoolean()用法及代碼示例
- Processing JSONObject.getInt()用法及代碼示例
- Processing JSONObject.setBoolean()用法及代碼示例
- Processing JSONObject用法及代碼示例
- Processing JSONArray.getIntArray()用法及代碼示例
- Processing JSONArray.getFloat()用法及代碼示例
- Processing JSONArray.setString()用法及代碼示例
- Processing JSONArray.setFloat()用法及代碼示例
- Processing JSONArray.remove()用法及代碼示例
- Processing JSONArray.getString()用法及代碼示例
- Processing JSONArray.setBoolean()用法及代碼示例
- Processing JSONArray.getJSONArray()用法及代碼示例
- Processing JSONArray.setJSONObject()用法及代碼示例
- Processing JSONArray.getJSONObject()用法及代碼示例
- Processing JSONArray.size()用法及代碼示例
- Processing JSONArray.isNull()用法及代碼示例
注:本文由純淨天空篩選整理自processing.org大神的英文原創作品 JSONObject.isNull()。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。