Share via


DateTimeFormatter.ParseUnresolved Method

Definition

Overloads

ParseUnresolved(String, ParsePosition)

Parses the text using this formatter, without resolving the result, intended for advanced use cases.

ParseUnresolved(ICharSequence, ParsePosition)

Parses the text using this formatter, without resolving the result, intended for advanced use cases.

ParseUnresolved(String, ParsePosition)

Parses the text using this formatter, without resolving the result, intended for advanced use cases.

public Java.Time.Temporal.ITemporalAccessor? ParseUnresolved (string? text, Java.Text.ParsePosition? position);
member this.ParseUnresolved : string * Java.Text.ParsePosition -> Java.Time.Temporal.ITemporalAccessor

Parameters

text
String

the text to parse, not null

position
ParsePosition

the position to parse from, updated with length parsed and the index of any error, not null

Returns

the parsed text, null if the parse results in an error

Remarks

Parses the text using this formatter, without resolving the result, intended for advanced use cases.

Parsing is implemented as a two-phase operation. First, the text is parsed using the layout defined by the formatter, producing a Map of field to value, a ZoneId and a Chronology. Second, the parsed data is <em>resolved</em>, by validating, combining and simplifying the various fields into more useful ones. This method performs the parsing stage but not the resolving stage.

The result of this method is TemporalAccessor which represents the data as seen in the input. Values are not validated, thus parsing a date string of '2012-00-65' would result in a temporal with three fields - year of '2012', month of '0' and day-of-month of '65'.

The text will be parsed from the specified start ParsePosition. The entire length of the text does not have to be parsed, the ParsePosition will be updated with the index at the end of parsing.

Errors are returned using the error index field of the ParsePosition instead of DateTimeParseException. The returned error index will be set to an index indicative of the error. Callers must check for errors before using the result.

If the formatter parses the same field more than once with different values, the result will be an error.

This method is intended for advanced use cases that need access to the internal state during parsing. Typical application code should use #parse(CharSequence, TemporalQuery) or the parse method on the target type.

Java documentation for java.time.format.DateTimeFormatter.parseUnresolved(java.lang.CharSequence, 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

ParseUnresolved(ICharSequence, ParsePosition)

Parses the text using this formatter, without resolving the result, intended for advanced use cases.

[Android.Runtime.Register("parseUnresolved", "(Ljava/lang/CharSequence;Ljava/text/ParsePosition;)Ljava/time/temporal/TemporalAccessor;", "", ApiSince=26)]
public Java.Time.Temporal.ITemporalAccessor? ParseUnresolved (Java.Lang.ICharSequence? text, Java.Text.ParsePosition? position);
[<Android.Runtime.Register("parseUnresolved", "(Ljava/lang/CharSequence;Ljava/text/ParsePosition;)Ljava/time/temporal/TemporalAccessor;", "", ApiSince=26)>]
member this.ParseUnresolved : Java.Lang.ICharSequence * Java.Text.ParsePosition -> Java.Time.Temporal.ITemporalAccessor

Parameters

text
ICharSequence

the text to parse, not null

position
ParsePosition

the position to parse from, updated with length parsed and the index of any error, not null

Returns

the parsed text, null if the parse results in an error

Attributes

Remarks

Parses the text using this formatter, without resolving the result, intended for advanced use cases.

Parsing is implemented as a two-phase operation. First, the text is parsed using the layout defined by the formatter, producing a Map of field to value, a ZoneId and a Chronology. Second, the parsed data is <em>resolved</em>, by validating, combining and simplifying the various fields into more useful ones. This method performs the parsing stage but not the resolving stage.

The result of this method is TemporalAccessor which represents the data as seen in the input. Values are not validated, thus parsing a date string of '2012-00-65' would result in a temporal with three fields - year of '2012', month of '0' and day-of-month of '65'.

The text will be parsed from the specified start ParsePosition. The entire length of the text does not have to be parsed, the ParsePosition will be updated with the index at the end of parsing.

Errors are returned using the error index field of the ParsePosition instead of DateTimeParseException. The returned error index will be set to an index indicative of the error. Callers must check for errors before using the result.

If the formatter parses the same field more than once with different values, the result will be an error.

This method is intended for advanced use cases that need access to the internal state during parsing. Typical application code should use #parse(CharSequence, TemporalQuery) or the parse method on the target type.

Java documentation for java.time.format.DateTimeFormatter.parseUnresolved(java.lang.CharSequence, 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