JSONObject.OptDouble Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| Name | Description |
|---|---|
| OptDouble(String) |
Returns the value mapped by |
| OptDouble(String, Double) |
Returns the value mapped by |
OptDouble(String)
Returns the value mapped by name if it exists and is a double or
can be coerced to a double, or NaN otherwise.
[Android.Runtime.Register("optDouble", "(Ljava/lang/String;)D", "GetOptDouble_Ljava_lang_String_Handler")]
public virtual double OptDouble(string? name);
[<Android.Runtime.Register("optDouble", "(Ljava/lang/String;)D", "GetOptDouble_Ljava_lang_String_Handler")>]
abstract member OptDouble : string -> double
override this.OptDouble : string -> double
Parameters
- name
- String
The name of the value to read, or null if no name is supplied.
Returns
The number or numeric string converted to a double, or NaN if the mapping is missing or the value cannot be converted.
- Attributes
Remarks
Returns the value mapped by name if it exists and is a double or can be coerced to a double, or NaN otherwise.
Java documentation for org.json.JSONObject.optDouble(java.lang.String).
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
OptDouble(String, Double)
Returns the value mapped by name if it exists and is a double or
can be coerced to a double, or fallback otherwise.
[Android.Runtime.Register("optDouble", "(Ljava/lang/String;D)D", "GetOptDouble_Ljava_lang_String_DHandler")]
public virtual double OptDouble(string? name, double fallback);
[<Android.Runtime.Register("optDouble", "(Ljava/lang/String;D)D", "GetOptDouble_Ljava_lang_String_DHandler")>]
abstract member OptDouble : string * double -> double
override this.OptDouble : string * double -> double
Parameters
- name
- String
The name of the value to read, or null if no name is supplied.
- fallback
- Double
The value to return if the mapping is missing or its value cannot be converted to a double.
Returns
The number or numeric string converted to a double, or fallback if conversion fails. A string that represents NaN converts to NaN, not the fallback.
- Attributes
Remarks
Returns the value mapped by name if it exists and is a double or can be coerced to a double, or fallback otherwise.
Java documentation for org.json.JSONObject.optDouble(java.lang.String, double).
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.