JSONArray.OptLong 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 |
|---|---|
| OptLong(Int32) |
Returns the value at |
| OptLong(Int32, Int64) |
Returns the value at |
OptLong(Int32)
Returns the value at index if it exists and is a long or
can be coerced to a long.
[Android.Runtime.Register("optLong", "(I)J", "GetOptLong_IHandler")]
public virtual long OptLong(int index);
[<Android.Runtime.Register("optLong", "(I)J", "GetOptLong_IHandler")>]
abstract member OptLong : int -> int64
override this.OptLong : int -> int64
Parameters
- index
- Int32
The zero-based index of the value to read.
Returns
The number converted to a long integer, or 0 if the value is missing, null, or cannot be converted. Numeric strings are parsed as Java doubles and then cast to long integers; this can lose precision for large values.
- Attributes
Remarks
Returns the value at index if it exists and is a long or can be coerced to a long. Returns 0 otherwise.
Java documentation for org.json.JSONArray.optLong(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
OptLong(Int32, Int64)
Returns the value at index if it exists and is a long or
can be coerced to a long.
[Android.Runtime.Register("optLong", "(IJ)J", "GetOptLong_IJHandler")]
public virtual long OptLong(int index, long fallback);
[<Android.Runtime.Register("optLong", "(IJ)J", "GetOptLong_IJHandler")>]
abstract member OptLong : int * int64 -> int64
override this.OptLong : int * int64 -> int64
Parameters
- index
- Int32
The zero-based index of the value to read.
- fallback
- Int64
The value to return if the requested value is missing, null, or cannot be converted to a long integer.
Returns
The number converted to a long integer, or fallback if conversion fails. Numeric strings are parsed as Java doubles and then cast to long integers; this can lose precision for large values.
- Attributes
Remarks
Returns the value at index if it exists and is a long or can be coerced to a long. Returns fallback otherwise.
Java documentation for org.json.JSONArray.optLong(int, long).
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.