String

extension String
  • Returns a Date? from an iso8601 string representation, with or without fractional seconds.

    Declaration

    Swift

    var iso8601ms: Date? { get }
  • Escapes Postgres LIKE/ILIKE wildcard characters (“_” and “%”) so they’re matched as literals instead of being interpreted as wildcards, then trims leading/trailing whitespace. Use this on any user-supplied string before passing it to ILIKE, ~~, or fullTextFilter.

    Declaration

    Swift

    func escapedForSQLWildcards() -> String
  • Converts a string to the form we will use for puzzle answer comparison. We don’t store answers normalized because when they are correct we will show them in their original form. We do store hint keys like this so we can do a dictionary lookup.

    Declaration

    Swift

    func normalizePuzzleAnswer() -> String

Utilities