NumberFormat.Parse Method

Definition

Overloads

Parse(String)

Parses text from the beginning of the given string to produce a number.

Parse(String, ParsePosition)

Returns a Long if possible (e.

Parse(String)

Parses text from the beginning of the given string to produce a number.

[Android.Runtime.Register("parse", "(Ljava/lang/String;)Ljava/lang/Number;", "GetParse_Ljava_lang_String_Handler", ApiSince=24)]
public virtual Java.Lang.Number? Parse (string? text);
[<Android.Runtime.Register("parse", "(Ljava/lang/String;)Ljava/lang/Number;", "GetParse_Ljava_lang_String_Handler", ApiSince=24)>]
abstract member Parse : string -> Java.Lang.Number
override this.Parse : string -> Java.Lang.Number

Parameters

text
String

A String whose beginning should be parsed.

Returns

A Number parsed from the string.

Attributes

Remarks

Parses text from the beginning of the given string to produce a number. The method might not use the entire text of the given string.

Java documentation for android.icu.text.NumberFormat.parse(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

Parse(String, ParsePosition)

Returns a Long if possible (e.

[Android.Runtime.Register("parse", "(Ljava/lang/String;Ljava/text/ParsePosition;)Ljava/lang/Number;", "GetParse_Ljava_lang_String_Ljava_text_ParsePosition_Handler", ApiSince=24)]
public abstract Java.Lang.Number? Parse (string? text, Java.Text.ParsePosition? parsePosition);
[<Android.Runtime.Register("parse", "(Ljava/lang/String;Ljava/text/ParsePosition;)Ljava/lang/Number;", "GetParse_Ljava_lang_String_Ljava_text_ParsePosition_Handler", ApiSince=24)>]
abstract member Parse : string * Java.Text.ParsePosition -> Java.Lang.Number

Parameters

text
String
parsePosition
ParsePosition

Returns

Attributes

Remarks

Returns a Long if possible (e.g., within the range [Long.MIN_VALUE, Long.MAX_VALUE] and with no decimals); otherwise, returns another type, such as a BigDecimal, BigInteger, or Double. The return type is not guaranteed other than for the Long case.

If IntegerOnly is set, will stop at a decimal point (or equivalent; e.g., for rational numbers "1 2/3", will stop after the 1).

Does not throw an exception; if no object can be parsed, index is unchanged!

For more detail on parsing, see the "Parsing" header in the class documentation of DecimalFormat.

Java documentation for android.icu.text.NumberFormat.parse(java.lang.String, java.text.ParsePosition).

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