ios - Swift3 version for emojilessStringWithSubstitution -
my current implementation has :
var emojilessstringwithsubstitution: string { let emojipatterns = [unicodescalar(0x10000)...unicodescalar(0x10ffff), unicodescalar(0x2600)...unicodescalar(0x27ff)] return self.unicodescalars .filter { ucscalar in !(emojipatterns.contains{ $0 ~= ucscalar }) } .reduce("") { $0 + string($1) } }
errors occur : 1. integer literals overflow when stored uint8 2. when store unicode scalar in variables , try assign error binary operator '...' cannot applied 2 'unicodescalar?' operands
kindly help.
modify code below,
var emojilessstringwithsubstitution: string { let emojipatterns = [0x10000...0x10ffff, 0x2600...0x27ff] return self.unicodescalars .filter { ucscalar in !(emojipatterns.contains{ $0 ~= int(ucscalar.value) }) } .reduce("") { $0 + string($1) } }
Comments
Post a Comment