Udostępnij za pośrednictwem


JSONObject.OptString Method

Definition

Overloads

OptString(String)

Returns the value mapped by name if it exists, coercing it if necessary, or the empty string if no such mapping exists.

OptString(String, String)

Returns the value mapped by name if it exists, coercing it if necessary, or fallback if no such mapping exists.

OptString(String)

Returns the value mapped by name if it exists, coercing it if necessary, or the empty string if no such mapping exists.

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

Parameters

name
String

Returns

Attributes

Remarks

Returns the value mapped by name if it exists, coercing it if necessary, or the empty string if no such mapping exists.

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

OptString(String, String)

Returns the value mapped by name if it exists, coercing it if necessary, or fallback if no such mapping exists.

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

Parameters

name
String
fallback
String

Returns

Attributes

Remarks

Returns the value mapped by name if it exists, coercing it if necessary, or fallback if no such mapping exists.

Java documentation for org.json.JSONObject.optString(java.lang.String, 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