swift - Extra \N{...} when using kCFStringTransformToUnicodeName or NSStringTransformToUnicodeName -
let string = "\u{00a0}" // no-break space let transformed = string.stringbyapplyingtransform(nsstringtransformtounicodename, reverse: false)
expected result: no-break space
actual result: \n{no_break_space}
why \n{
, }
? for, , there way remove them, short of regex/scanning/parsing/etc?
that's way icu & unicode represent named code points in regular expressions. i'm not surprised output @ all.
here link reference syntax @ unicode.org.
that's explained in other page @ icu project.
ps: \n{}
shorter equivalent \p{name=…}
— explained in unicode.org page above linked anchor). can see similar syntaxes in regular-expressions.info mention \p{…}
syntax defining unicode codepoints using properties.
Comments
Post a Comment