Skip to content

Conversation

sakmt
Copy link

@sakmt sakmt commented Sep 18, 2018

Sorry, this pull request is Japanese only!!

問題

文字列に絵文字が含まれていた場合、絵文字の数だけNSRangeの末尾がカットされているようです。

// addAttribute(.hashTag, attribute: .textColor(.red)) で赤くなる文字
"hoge #fuga" // => #fuga
"hoge🍣 #fuga" // => #fug
"hoge🍣🍶 #fuga" // => #fu

解決策

UTF16に変換してcountすることで解決すると思われます。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant