Condividi tramite


DateFormat.ParseObject(String, ParsePosition) Method

Definition

Parses text from a string to produce a Date.

[Android.Runtime.Register("parseObject", "(Ljava/lang/String;Ljava/text/ParsePosition;)Ljava/lang/Object;", "GetParseObject_Ljava_lang_String_Ljava_text_ParsePosition_Handler")]
public override Java.Lang.Object? ParseObject (string source, Java.Text.ParsePosition pos);
[<Android.Runtime.Register("parseObject", "(Ljava/lang/String;Ljava/text/ParsePosition;)Ljava/lang/Object;", "GetParseObject_Ljava_lang_String_Ljava_text_ParsePosition_Handler")>]
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 Date parsed from the string. In case of error, returns null.

Attributes

Remarks

Parses text from a string to produce a Date.

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 date 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 date parsing.

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