DateTimeParserBuilder

interface DateTimeParserBuilder

Functions

anyOf
Link copied to clipboard
common

Try each of the parsers defined by builders until one succeeds. If none succeed, parsing is considered to have failed.

abstract fun anyOf(vararg builders: Array<Out DateTimeParserBuilder.() -> Unit>)

Try each of the parsers defined by childParsers until one succeeds. If none succeed, parsing is considered to have failed.

abstract fun anyOf(vararg childParsers: Array<Out DateTimeParser>)
caseInsensitive
Link copied to clipboard
common

Force parsing to be case-insensitive within this block.

abstract fun caseInsensitive(builder: DateTimeParserBuilder.() -> Unit)
caseSensitive
Link copied to clipboard
common

Force parsing to be case-sensitive within this block.

abstract fun caseSensitive(builder: DateTimeParserBuilder.() -> Unit)
childParser
Link copied to clipboard
common

Use a parser that has been defined outside of this builder.

abstract fun childParser(childParser: DateTimeParser)
decimalNumber
Link copied to clipboard
common

Parse a decimal number.

If the minimum fractionLength is zero, a decimal separator isn't required.

The characters associated with a decimal separator are controlled by the DateTimeParserSettings. By default, this is '.' or ',' as specified in ISO-8601. The characters may be overridden by using a different NumberStyle.

abstract fun decimalNumber(wholeLength: IntRange, fractionLength: IntRange, fractionScale: Int, builder: DecimalNumberParserBuilder.() -> Unit)
equals
Link copied to clipboard
common
open operator override fun equals(other: Any?): Boolean
hashCode
Link copied to clipboard
common
open override fun hashCode(): Int
literal
Link copied to clipboard
common

Parse a Char literal.

abstract fun literal(char: Char, builder: LiteralParserBuilder.() -> Unit)

Parse a String literal.

abstract fun literal(string: String, builder: LiteralParserBuilder.() -> Unit)
localizedText
Link copied to clipboard
common

Parse localized text associated with a particular DateTimeField in any of the specified styles. If successful, the field's value will be populated. If no text is known for the field or a match can't be found, the parsing operation will return an error.

The locale used when matching text is determined by the DateTimeParserSettings in use. Text is provided by the configured DateTimeTextProvider. Be mindful that this text may differ between platforms and devices. If at all possible, non-localized representations should be used instead.

abstract fun localizedText(field: DateTimeField, styles: Set<TextStyle>)
optional
Link copied to clipboard
common

Make parsing optional within a block.

If any of the parsers defined within builder fail, the parse result will be reset to its state before the block started and parsing will continue on, assuming there are additional parsers remaining.

abstract fun optional(builder: DateTimeParserBuilder.() -> Unit)
sign
Link copied to clipboard
common

Parse a character indicating the sign of a number.

The characters associated with a number's sign are controlled by the DateTimeParserSettings. By default, this is '+', '-', or '−' as specified in ISO-8601. The characters may be overridden by using a different NumberStyle.

abstract fun sign(builder: SignParserBuilder.() -> Unit)
string
Link copied to clipboard
common

Parse a variable length string.

Each character will be parsed starting from the current position until either the maximum number of characters allowed by length is reached or parsing is stopped by a StringParserBuilder.onEachChar handler.

abstract fun string(length: IntRange, builder: StringParserBuilder.() -> Unit)
toString
Link copied to clipboard
common
open override fun toString(): String
unaryPlus
Link copied to clipboard
common

Parse a Char literal.

open operator fun Char.unaryPlus()

Parse a String literal.

open operator fun String.unaryPlus()
wholeNumber
Link copied to clipboard
common

Parse a whole number of fixed length.

abstract fun wholeNumber(length: Int, builder: WholeNumberParserBuilder.() -> Unit)

Parse a whole number of variable length.

abstract fun wholeNumber(length: IntRange, builder: WholeNumberParserBuilder.() -> Unit)

Extensions

amPm
Link copied to clipboard
common

Parse the AM or PM of the day from its textual representation.

The result will be associated with DateTimeField.AM_PM_OF_DAY.

fun DateTimeParserBuilder.amPm()
dayOfMonth
Link copied to clipboard
common

Parse a day of the month value with a variable number of digits.

The result will be associated with DateTimeField.DAY_OF_MONTH.

inline fun DateTimeParserBuilder.dayOfMonth(length: IntRange, crossinline builder: WholeNumberParserBuilder.() -> Unit)

Parse a day of the month value with a fixed number of digits.

The result will be associated with DateTimeField.DAY_OF_MONTH.

inline fun DateTimeParserBuilder.dayOfMonth(length: Int, crossinline builder: WholeNumberParserBuilder.() -> Unit)
dayOfWeekNumber
Link copied to clipboard
common

Parse a day of week number with a fixed number of digits.

The result will be associated with DateTimeField.DAY_OF_WEEK.

inline fun DateTimeParserBuilder.dayOfWeekNumber(length: Int, crossinline builder: WholeNumberParserBuilder.() -> Unit)
dayOfYear
Link copied to clipboard
common

Parse a day of the year value with a variable number of digits.

The result will be associated with DateTimeField.DAY_OF_YEAR.

inline fun DateTimeParserBuilder.dayOfYear(length: IntRange, crossinline builder: WholeNumberParserBuilder.() -> Unit)

Parse a day of the year value with a fixed number of digits.

The result will be associated with DateTimeField.DAY_OF_YEAR.

inline fun DateTimeParserBuilder.dayOfYear(length: Int, crossinline builder: WholeNumberParserBuilder.() -> Unit)
durationOfFractionalSeconds
Link copied to clipboard
common

Parse a duration of fractional seconds.

The number of whole seconds will be associated with DateTimeField.DURATION_OF_SECONDS while any fractional part will be associated with DateTimeField.NANOSECOND_OF_SECOND. The decimal separator character will be determined by the DateTimeParserSettings.

inline fun DateTimeParserBuilder.durationOfFractionalSeconds(wholeLength: IntRange, fractionLength: IntRange, fractionScale: Int, crossinline builder: DecimalNumberParserBuilder.() -> Unit)
durationOfHours
Link copied to clipboard
common

Parse a duration of whole hours.

The number of hours will be associated with DateTimeField.DURATION_OF_HOURS.

inline fun DateTimeParserBuilder.durationOfHours(length: IntRange, crossinline builder: WholeNumberParserBuilder.() -> Unit)
durationOfMinutes
Link copied to clipboard
common

Parse a duration of whole minutes.

The number of minutes will be associated with DateTimeField.DURATION_OF_MINUTES.

inline fun DateTimeParserBuilder.durationOfMinutes(length: IntRange, crossinline builder: WholeNumberParserBuilder.() -> Unit)
durationOfSeconds
Link copied to clipboard
common

Parse a duration of whole seconds.

The number of seconds will be associated with DateTimeField.DURATION_OF_SECONDS.

inline fun DateTimeParserBuilder.durationOfSeconds(length: IntRange, crossinline builder: WholeNumberParserBuilder.() -> Unit)
era
Link copied to clipboard
common

Parse an era from its textual representation in any of the specified styles.

The result will be associated with DateTimeField.ERA.

fun DateTimeParserBuilder.era(styles: Set<TextStyle>)

Parse an era from its textual representation in a specific style.

The result will be associated with DateTimeField.ERA.

fun DateTimeParserBuilder.era(style: TextStyle)
fractionalSecondOfMinute
Link copied to clipboard
common

Parse a fractional second of the minute.

The number of whole seconds will be associated with DateTimeField.SECOND_OF_MINUTE while any fractional part will be associated with DateTimeField.NANOSECOND_OF_SECOND. The decimal separator character will be determined by the DateTimeParserSettings.

inline fun DateTimeParserBuilder.fractionalSecondOfMinute(wholeLength: IntRange, fractionLength: IntRange, fractionScale: Int, crossinline builder: DecimalNumberParserBuilder.() -> Unit)

Parse a fractional second of the minute with a fixed number of characters representing the whole second.

The number of whole seconds will be associated with DateTimeField.SECOND_OF_MINUTE while any fractional part will be associated with DateTimeField.NANOSECOND_OF_SECOND. The decimal separator character will be determined by the DateTimeParserSettings.

inline fun DateTimeParserBuilder.fractionalSecondOfMinute(wholeLength: Int, fractionLength: IntRange, fractionScale: Int, crossinline builder: DecimalNumberParserBuilder.() -> Unit)
hourOfDay
Link copied to clipboard
common

Parse an hour of the day with a variable number of digits.

The result will be associated with DateTimeField.HOUR_OF_DAY.

inline fun DateTimeParserBuilder.hourOfDay(length: IntRange, crossinline builder: WholeNumberParserBuilder.() -> Unit)

Parse an hour of the day with a fixed number of digits.

The result will be associated with DateTimeField.HOUR_OF_DAY.

inline fun DateTimeParserBuilder.hourOfDay(length: Int, crossinline builder: WholeNumberParserBuilder.() -> Unit)
localizedDayOfWeek
Link copied to clipboard
common

Parse a day of the week from its textual representation in any of the specified styles.

The result will be associated with DateTimeField.DAY_OF_WEEK.

fun DateTimeParserBuilder.localizedDayOfWeek(styles: Set<TextStyle>)

Parse a day of the week from its textual representation in a specific style.

The result will be associated with DateTimeField.DAY_OF_WEEK.

fun DateTimeParserBuilder.localizedDayOfWeek(style: TextStyle)
localizedMonth
Link copied to clipboard
common

Parse a month from its textual representation in any of the specified styles.

The result will be associated with DateTimeField.MONTH_OF_YEAR.

fun DateTimeParserBuilder.localizedMonth(styles: Set<TextStyle>)

Parse a month from its textual representation in a specific style.

The result will be associated with DateTimeField.MONTH_OF_YEAR.

fun DateTimeParserBuilder.localizedMonth(style: TextStyle)
minuteOfHour
Link copied to clipboard
common

Parse a minute of the hour with a variable number of digits.

The result will be associated with DateTimeField.MINUTE_OF_HOUR.

inline fun DateTimeParserBuilder.minuteOfHour(length: IntRange, crossinline builder: WholeNumberParserBuilder.() -> Unit)

Parse a minute of the hour with a fixed number of digits.

The result will be associated with DateTimeField.MINUTE_OF_HOUR.

inline fun DateTimeParserBuilder.minuteOfHour(length: Int, crossinline builder: WholeNumberParserBuilder.() -> Unit)
monthNumber
Link copied to clipboard
common

Parse a month of year value with a variable number of digits.

The result will be associated with DateTimeField.MONTH_OF_YEAR.

inline fun DateTimeParserBuilder.monthNumber(length: IntRange, crossinline builder: WholeNumberParserBuilder.() -> Unit)

Parse a month of year number with a fixed number of digits.

The result will be associated with DateTimeField.MONTH_OF_YEAR.

inline fun DateTimeParserBuilder.monthNumber(length: Int, crossinline builder: WholeNumberParserBuilder.() -> Unit)
periodOfDays
Link copied to clipboard
common

Parse a period of whole days.

The number of days will be associated with DateTimeField.PERIOD_OF_DAYS.

inline fun DateTimeParserBuilder.periodOfDays(length: IntRange, crossinline builder: WholeNumberParserBuilder.() -> Unit)
periodOfMonths
Link copied to clipboard
common

Parse a period of whole months.

The number of months will be associated with DateTimeField.PERIOD_OF_MONTHS.

inline fun DateTimeParserBuilder.periodOfMonths(length: IntRange, crossinline builder: WholeNumberParserBuilder.() -> Unit)
periodOfWeeks
Link copied to clipboard
common

Parse a period of whole weeks.

The number of weeks will be associated with DateTimeField.PERIOD_OF_WEEKS.

inline fun DateTimeParserBuilder.periodOfWeeks(length: IntRange, crossinline builder: WholeNumberParserBuilder.() -> Unit)
periodOfYears
Link copied to clipboard
common

Parse a period of whole years.

The number of years will be associated with DateTimeField.PERIOD_OF_YEARS.

inline fun DateTimeParserBuilder.periodOfYears(length: IntRange, crossinline builder: WholeNumberParserBuilder.() -> Unit)
periodSign
Link copied to clipboard
common

Parses a number's sign and populates DateTimeField.PERIOD_SIGN with -1L, if negative or 1L, if positive.

fun DateTimeParserBuilder.periodSign()
secondOfMinute
Link copied to clipboard
common

Parse a second of the minute with a variable number of digits.

The result will be associated with DateTimeField.SECOND_OF_MINUTE.

inline fun DateTimeParserBuilder.secondOfMinute(length: IntRange, crossinline builder: WholeNumberParserBuilder.() -> Unit)

Parse a second of the minute with a fixed number of digits.

The result will be associated with DateTimeField.SECOND_OF_MINUTE.

inline fun DateTimeParserBuilder.secondOfMinute(length: Int, crossinline builder: WholeNumberParserBuilder.() -> Unit)
timeZoneId
Link copied to clipboard
common

Parse a time zone region ID.

The format should match that defined in the IANA time zone database. The parsed string will be associated with DateTimeParseResult.timeZoneId.

fun DateTimeParserBuilder.timeZoneId()
unboundedDesignator
Link copied to clipboard
common

Parses the string ".." and populates DateTimeField.IS_UNBOUNDED with 1L.

fun DateTimeParserBuilder.unboundedDesignator()
utcDesignator
Link copied to clipboard
common

Parses the character 'Z' and populates DateTimeField.UTC_OFFSET_TOTAL_SECONDS with 0L.

fun DateTimeParserBuilder.utcDesignator()
utcOffsetHours
Link copied to clipboard
common
inline fun DateTimeParserBuilder.utcOffsetHours(length: Int, crossinline builder: WholeNumberParserBuilder.() -> Unit)
utcOffsetMinutes
Link copied to clipboard
common
inline fun DateTimeParserBuilder.utcOffsetMinutes(length: Int, crossinline builder: WholeNumberParserBuilder.() -> Unit)
utcOffsetSeconds
Link copied to clipboard
common
inline fun DateTimeParserBuilder.utcOffsetSeconds(length: Int, crossinline builder: WholeNumberParserBuilder.() -> Unit)
utcOffsetSign
Link copied to clipboard
common

Parses a number's sign and populates DateTimeField.UTC_OFFSET_SIGN with -1L, if negative or 1L, if positive.

fun DateTimeParserBuilder.utcOffsetSign()
year
Link copied to clipboard
common

Parse a year with a variable number of digits.

The result will be associated with DateTimeField.YEAR.

inline fun DateTimeParserBuilder.year(length: IntRange, crossinline builder: WholeNumberParserBuilder.() -> Unit)

Parse a year with a fixed number of digits.

The result will be associated with DateTimeField.YEAR.

inline fun DateTimeParserBuilder.year(length: Int, crossinline builder: WholeNumberParserBuilder.() -> Unit)
yearOfEra
Link copied to clipboard
common

Parse a year of era with a variable number of digits.

The result will be associated with DateTimeField.YEAR_OF_ERA.

inline fun DateTimeParserBuilder.yearOfEra(length: IntRange, crossinline builder: WholeNumberParserBuilder.() -> Unit)

Parse a year of era with a fixed number of digits.

The result will be associated with DateTimeField.YEAR_OF_ERA.

inline fun DateTimeParserBuilder.yearOfEra(length: Int, crossinline builder: WholeNumberParserBuilder.() -> Unit)