Closed muradtries closed 3 months ago
@muradtries For example, you have Notation like below:
Notation(
character: "N",
characterSet: CharacterSet.letters
.union(CharacterSet.decimalDigits)
.union(CharacterSet.whitespaces)
.union(CharacterSet.symbols)
.union(CharacterSet.punctuationCharacters),
isOptional: false
)
You can add count limit like below:
public enum InputMaskType {
case text(_ charCount: Int?)
case amount
var maskValue: String {
switch self {
case .text(let charCount):
if let charCount, charCount > 0 {
return "[\(String(repeating: "N", count: charCount))]"
} else {
return "[N…]"
}
case .amount:
return "[0999999999]{.}[00]"
}
}
Thanks a lot @elshadpb for possible solution. As there is no other alternative currently, I'm going to close this issue.
Is there any shorthand syntax for setting character limit for homogeneous mask? I looked through the wiki, but couldn't find related information.