Language

JSONArray.OptDouble Method

Definition

Overloads

Name Description
OptDouble(Int32, Double)

Returns the value at index if it exists and is a double or can be coerced to a double.

OptDouble(Int32)

Returns the value at index if it exists and is a double or can be coerced to a double.

OptDouble(Int32, Double)

Returns the value at index if it exists and is a double or can be coerced to a double.

[Android.Runtime.Register("optDouble", "(ID)D", "GetOptDouble_IDHandler")]
public virtual double OptDouble(int index, double fallback);
[<Android.Runtime.Register("optDouble", "(ID)D", "GetOptDouble_IDHandler")>]
abstract member OptDouble : int * double -> double
override this.OptDouble : int * double -> double

Parameters

index
Int32

The zero-based index of the value to read.

fallback
Double

The value to return if the requested value is missing, null, or 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 at index if it exists and is a double or can be coerced to a double. Returns fallback otherwise.

Java documentation for org.json.JSONArray.optDouble(int, 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.

Applies to

OptDouble(Int32)

Returns the value at index if it exists and is a double or can be coerced to a double.

[Android.Runtime.Register("optDouble", "(I)D", "GetOptDouble_IHandler")]
public virtual double OptDouble(int index);
[<Android.Runtime.Register("optDouble", "(I)D", "GetOptDouble_IHandler")>]
abstract member OptDouble : int -> double
override this.OptDouble : int -> double

Parameters

index
Int32

The zero-based index of the value to read.

Returns

The number or numeric string converted to a double, or NaN if the value is missing, null, or cannot be converted.

Attributes

Remarks

Returns the value at index if it exists and is a double or can be coerced to a double. Returns NaN otherwise.

Java documentation for org.json.JSONArray.optDouble(int).

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