NumberFormat.ParseObject(String, ParsePosition) Method

Definition

Parses text from a string to produce a Number.

[Android.Runtime.Register("parseObject", "(Ljava/lang/String;Ljava/text/ParsePosition;)Ljava/lang/Object;", "")]
public override sealed Java.Lang.Object? ParseObject (string source, Java.Text.ParsePosition pos);
[<Android.Runtime.Register("parseObject", "(Ljava/lang/String;Ljava/text/ParsePosition;)Ljava/lang/Object;", "")>]
override this.ParseObject : string * Java.Text.ParsePosition -> Java.Lang.Object

Parameters

source
String

A String, part of which should be parsed.

pos
ParsePosition

A ParsePosition object with index and error index information as described above.

Returns

A Number parsed from the string. In case of error, returns null.

Attributes

Remarks

Parses text from a string to produce a Number.

The method attempts to parse text starting at the index given by pos. If parsing succeeds, then the index of pos is updated to the index after the last character used (parsing does not necessarily use all characters up to the end of the string), and the parsed number is returned. The updated pos can be used to indicate the starting point for the next call to this method. If an error occurs, then the index of pos is not changed, the error index of pos is set to the index of the character where the error occurred, and null is returned.

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

Java documentation for java.text.NumberFormat.parseObject(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