Expression

This class contains pattern of expression and localized value as well as length variations if any are associated. During instance initialization pattern is analyzed and correct expression matcher is created. If no matcher matches the expression pattern then when validating there is only check if passed value is the same like pattern (equality). If there is matcher then its internal logic validates passed value.

  • Pattern of an expression.

    Declaration

    Swift

    let pattern: ExpressionPattern
  • A localized value. If length vartiations array is empty or you want to get full localized value use this property.

    Declaration

    Swift

    let value: String
  • Array of length variations.

    Declaration

    Swift

    let lengthVariations: [LengthVariation]
  • Expression matcher that is used in validation.

    Declaration

    Swift

    private var expressionMatcher: ExpressionMatcher? = nil
  • Returns expression object.

    Declaration

    Swift

    init(pattern: String, value: String, lengthVariations: [LengthVariation] = [LengthVariation]())
  • Method that validates passed string.

    Declaration

    Swift

    func validate(value: String) -> Bool

    Parameters

    value

    value that should be matched

    Return Value

    true if value match expression, otherwise false.

  • Method used to get ExpressionPatternType of passed expression pattern.

    Declaration

    Swift

    private func getExpressionType(pattern: ExpressionPattern) -> ExpressionPatternType?

    Parameters

    pattern

    expression pattern that will be checked.

    Return Value

    ExpressionPatternType if pattern is supported, otherwise nil.