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) -> BoolParameters
valuevalue that should be matched
Return Value
trueif value match expression, otherwisefalse. -
Method used to get
ExpressionPatternTypeof passed expression pattern.Declaration
Swift
private func getExpressionType(pattern: ExpressionPattern) -> ExpressionPatternType?Parameters
patternexpression pattern that will be checked.
Return Value
ExpressionPatternTypeif pattern is supported, otherwise nil.
View on GitHub
Expression Struct Reference