JSONArray.OptString Method

Definition

Overloads

OptString(Int32)

Returns the value at index if it exists, coercing it if necessary.

OptString(Int32, String)

Returns the value at index if it exists, coercing it if necessary.

OptString(Int32)

Returns the value at index if it exists, coercing it if necessary.

[Android.Runtime.Register("optString", "(I)Ljava/lang/String;", "GetOptString_IHandler")]
public virtual string? OptString (int index);
[<Android.Runtime.Register("optString", "(I)Ljava/lang/String;", "GetOptString_IHandler")>]
abstract member OptString : int -> string
override this.OptString : int -> string

Parameters

index
Int32

Returns

Attributes

Remarks

Returns the value at index if it exists, coercing it if necessary. Returns the empty string if no such value exists.

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

OptString(Int32, String)

Returns the value at index if it exists, coercing it if necessary.

[Android.Runtime.Register("optString", "(ILjava/lang/String;)Ljava/lang/String;", "GetOptString_ILjava_lang_String_Handler")]
public virtual string? OptString (int index, string? fallback);
[<Android.Runtime.Register("optString", "(ILjava/lang/String;)Ljava/lang/String;", "GetOptString_ILjava_lang_String_Handler")>]
abstract member OptString : int * string -> string
override this.OptString : int * string -> string

Parameters

index
Int32
fallback
String

Returns

Attributes

Remarks

Returns the value at index if it exists, coercing it if necessary. Returns fallback if no such value exists.

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