ExactLengthRule
public class ExactLengthRule : ValidationRule<String>
ExactLengthRule is a subclass of ValidationRule that is used to make sure a the value has an exact length.
-
Initializes an
ExactLengthRuleobject to validate the text of a field against an exact length.Declaration
Swift
public init(length: Int, message: String = "")Parameters
lengthInteger value of exact string length being specified.
messageString of error message.
Return Value
An initialized
ExactLengthRuleobject, or nil if an object could not be created for some reason. that would not result in an exception. -
Used to validate length of string.
Declaration
Swift
public override func validate(_ value: String?) -> String?Parameters
valueAny value to be checked for validation.
Return Value
Error Message. nil if validation is successful;
Stringif validation fails.
View on GitHub
ExactLengthRule Class Reference