Extended Protocol_StringProcessing
RegexComponent
extension RegexComponent
Topics
Type Aliases
Type Properties
static var http: Date.HTTPFormatStyleCreates a regex component to match an HTTP date and time, such as “2015-11-14’T’15:05:03’Z’”, and capture the string as aDateusing the time zone as specified in the string.static var httpComponents: DateComponents.HTTPFormatStyleCreates a regex component to match an HTTP date and time, such as “2015-11-14’T’15:05:03’Z’”, and capture the string as aDateComponentsusing the time zone as specified in the string.static var iso8601: Date.ISO8601FormatStyleCreates a regex component to match an ISO 8601 date and time, such as “2015-11-14’T’15:05:03’Z’”, and capture the string as aDateusing the time zone as specified in the string.static var iso8601Components: DateComponents.ISO8601FormatStyleCreates a regex component to match an ISO 8601 date and time, such as “2015-11-14’T’15:05:03’Z’”, and capture the string as aDateComponentsusing the time zone as specified in the string.
Type Methods
static func date(Date.FormatStyle.DateStyle, locale: Locale, timeZone: TimeZone, calendar: Calendar?) -> Date.ParseStrategyCreates a regex component to match a localized date string and capture the string as aDate. The string is expected to follow the format of whatDate.FormatStyle(date:locale:calendar:)produces.Datecreated by this regex component would be at 00:00:00 in the specified time zone.static func date(format: Date.FormatString, locale: Locale, timeZone: TimeZone, calendar: Calendar?, twoDigitStartDate: Date) -> SelfCreates a regex component to match a localized date string following the specified format and capture the string as aDate.static func dateTime(date: Date.FormatStyle.DateStyle, time: Date.FormatStyle.TimeStyle, locale: Locale, timeZone: TimeZone, calendar: Calendar?) -> Date.ParseStrategyCreates a regex component to match a localized date and time string and capture the string as aDate. The date string is expected to follow the format of whatDate.FormatStyle(date:time:locale:calendar:)produces.static func iso8601(timeZone: TimeZone, includingFractionalSeconds: Bool, dateSeparator: Date.ISO8601FormatStyle.DateSeparator, dateTimeSeparator: Date.ISO8601FormatStyle.DateTimeSeparator, timeSeparator: Date.ISO8601FormatStyle.TimeSeparator) -> SelfCreates a regex component to match an ISO 8601 date and time string without time zone, and capture the string as aDateusing the specifiedtimeZone. If the string contains time zone designators, matches up until the start of time zone designators.static func iso8601Components(timeZone: TimeZone, includingFractionalSeconds: Bool, dateSeparator: Date.ISO8601FormatStyle.DateSeparator, dateTimeSeparator: Date.ISO8601FormatStyle.DateTimeSeparator, timeSeparator: Date.ISO8601FormatStyle.TimeSeparator) -> SelfCreates a regex component to match an ISO 8601 date and time string without time zone, and capture the string as aDateComponentsusing the specifiedtimeZone. If the string contains time zone designators, matches up until the start of time zone designators.static func iso8601ComponentsWithTimeZone(includingFractionalSeconds: Bool, dateSeparator: Date.ISO8601FormatStyle.DateSeparator, dateTimeSeparator: Date.ISO8601FormatStyle.DateTimeSeparator, timeSeparator: Date.ISO8601FormatStyle.TimeSeparator, timeZoneSeparator: Date.ISO8601FormatStyle.TimeZoneSeparator) -> SelfCreates a regex component to match an ISO 8601 date and time string, including time zone, and capture the string as aDateComponentsusing the time zone as specified in the string.static func iso8601Date(timeZone: TimeZone, dateSeparator: Date.ISO8601FormatStyle.DateSeparator) -> SelfCreates a regex component to match an ISO 8601 date string, such as “2015-11-14”, and capture the string as aDate. The capturedDatewould be at midnight in the specifiedtimeZone.static func iso8601DateComponents(timeZone: TimeZone, dateSeparator: Date.ISO8601FormatStyle.DateSeparator) -> SelfCreates a regex component to match an ISO 8601 date string, such as “2015-11-14”, and capture the string as aDateComponents. The capturedDateComponentswould be at midnight in the specifiedtimeZone.static func iso8601WithTimeZone(includingFractionalSeconds: Bool, dateSeparator: Date.ISO8601FormatStyle.DateSeparator, dateTimeSeparator: Date.ISO8601FormatStyle.DateTimeSeparator, timeSeparator: Date.ISO8601FormatStyle.TimeSeparator, timeZoneSeparator: Date.ISO8601FormatStyle.TimeZoneSeparator) -> SelfCreates a regex component to match an ISO 8601 date and time string, including time zone, and capture the string as aDateusing the time zone as specified in the string.static func localizedCurrency(code: Locale.Currency, locale: Locale) -> SelfCreates a regex component to match a localized currency string and capture it as aDecimal. For example,localizedIntegerCurrency(code: "USD", locale: Locale(identifier: "en_US"))matches “$52,249.98” and captures it as 52249.98.static func localizedDecimal(locale: Locale) -> SelfCreates a regex component to match a localized number string and capture it as aDecimal.static func localizedDouble(locale: Locale) -> SelfCreates a regex component to match a localized number string and capture it as aDouble.static func localizedDoublePercentage(locale: Locale) -> SelfCreates a regex component to match a localized string representing a percentage and capture it as aDouble.static func localizedInteger(locale: Locale) -> SelfCreates a regex component to match a localized integer string and capture it as aInt.static func localizedIntegerCurrency(code: Locale.Currency, locale: Locale) -> SelfCreates a regex component to match a localized currency string and capture it as aInt. For example,localizedIntegerCurrency(code: "USD", locale: Locale(identifier: "en_US"))matches “$52,249” and captures it as 52249.static func localizedIntegerPercentage(locale: Locale) -> SelfCreates a regex component to match a localized string representing a percentage and capture it as aInt.