æåð©âð©âð§âðŠïŒå¥³æ§2人ã女ã®å1人ãç·ã®å1人ã®å®¶æïŒã¯ã次ã®ããã«ãšã³ã³ãŒããããŸãã
U+1F469
WOMAN
ã
âU+200D
ZWJ
ã
U+1F469
WOMAN
ã
U+200D
ZWJ
ã
U+1F467
GIRL
ã
U+200D
ZWJ
ã
U+1F466
BOY
ãããã£ãŠãéåžžã«èå³æ·±ããšã³ã³ãŒãæ¹åŒã§ããåäœãã¹ãã®å®ç§ãªã¿ãŒã²ããããã ããSwiftã¯ãã®åŠçæ¹æ³ãèªèããŠããªãããã§ãããããç§ã®æå³ã§ãïŒ
"ð©âð©âð§âðŠ".contains("ð©âð©âð§âðŠ") // true
"ð©âð©âð§âðŠ".contains("ð©") // false
"ð©âð©âð§âðŠ".contains("\u{200D}") // false
"ð©âð©âð§âðŠ".contains("ð§") // false
"ð©âð©âð§âðŠ".contains("ðŠ") // true
ããã§ãã¹ãŠã£ããã¯ãããããèªèº«ïŒè¯ãïŒãšç·ã®åïŒè¯ãïŒïŒãå«ãã§ãããšèšããŸããããããããã¯ããã¯å¥³æ§ã女ã®åããŸãã¯ãŒãå¹ ã®ãžã§ã€ããŒãå«ãŸããŠããªããšèšããŸããããã§äœãèµ·ãã£ãŠããã®ã§ããïŒãªãSwiftã¯å°å¹Žãå«ãŸããŠããã®ã«å¥³æ§ãå°å¥³ãå«ãŸããŠããªãããšãç¥ã£ãŠããã®ã§ããïŒãããåäžã®æåãšããŠæ±ãããããèªäœãå«ãã ãã§ãããšèªèããå Žåã¯ç解ã§ããŸãããããµãã³ã³ããŒãã³ãã1ã€ãããªããä»ã®ã³ã³ããŒãã³ãããªããšããäºå®ã¯ãç§ãå°æãããŸãã
ããã¯ãã®ãããªãã®ã䜿çšããŠãå€ãããŸãã"ð©".characters.first!
ã
ããã«äº€çµ¡ã¯ããã§ãïŒ
let manual = "\u{1F469}\u{200D}\u{1F469}\u{200D}\u{1F467}\u{200D}\u{1F466}"
Array(manual.characters) // ["ð©â", "ð©â", "ð§â", "ðŠ"]
ããã«ZWJãé 眮ããŠããæåé åã«ã¯åæ ãããŸããããã®åŸã®ããšã¯å°ãèªã£ãŠããŸããïŒ
manual.contains("ð©") // false
manual.contains("ð§") // false
manual.contains("ðŠ") // true
ã ããç§ã¯æåé åã§ãåãåäœããã...é åãã©ã®ããã«èŠãããç¥ã£ãŠããã®ã§ãããã¯éåžžã«è¿·æã§ãã
ããã¯ãã®ãããªãã®ã䜿çšããŠãå€ãããŸãã"ð©".characters.first!
ã
"ð©âð©âð§âðŠ".contains("\u{200D}")
ããã§ãfalseãè¿ããŸãããããããã°ãæ©èœãã¯ããããŸããã