This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Mask.swift | |
import Foundation | |
public extension String { | |
fileprivate static let anyoneCharUpper = "X" | |
fileprivate static let onlyCharUpper = "C" | |
fileprivate static let onlyNumberUpper = "N" | |
fileprivate static let anyoneChar = "x" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
public extension String { | |
var containsEmoji: Bool { | |
for scalar in unicodeScalars { | |
if scalar.value == 0x1F600 || scalar.value == 0x1F64F || | |
scalar.value == 0x1F300 || scalar.value == 0x1F5FF { | |
return true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
public extension String { | |
func stringWithFormattedAgency() -> String { | |
var formattedAgency = self.onlyNumbers() | |
let maximumSize = 4 | |
formattedAgency = formattedAgency.substringWithSizeMax(size: maximumSize) | |