Condividi tramite


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")]
public virtual Java.Lang.Number? Parse (string source);
[<Android.Runtime.Register("parse", "(Ljava/lang/String;)Ljava/lang/Number;", "GetParse_Ljava_lang_String_Handler")>]
abstract member Parse : string -> Java.Lang.Number
override this.Parse : string -> Java.Lang.Number

Parameters

source
String

A String whose beginning should be parsed.

Returns

A Number parsed from the string.

Attributes

Exceptions

if an error occurs during parsing.

Remarks

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

See the #parse(String, ParsePosition) method for more information on number parsing.

Java documentation for java.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")]
public abstract Java.Lang.Number? Parse (string source, 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")>]
abstract member Parse : string * Java.Text.ParsePosition -> Java.Lang.Number

Parameters

source
String

the String to parse

parsePosition
ParsePosition

the parse position

Returns

the parsed value

Attributes

Remarks

Returns a Long if possible (e.g., within the range [Long.MIN_VALUE, Long.MAX_VALUE] and with no decimals), otherwise a Double. 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!

Java documentation for java.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