2018-05-02 14:24
浏览 60

Go vs Swift中的UTF8字符串长度和索引

I have apps in Go and Swift which process strings, such as finding substrings and their indices. At first it worked nicely even with multi-byte characters (e.g. emojis), using to Go's utf8.RuneCountInString() and Swift's native String.

But there are some UTF8 characters that break the string length and indices for substrings, e.g. a string "Lorem

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

2条回答 默认 最新

  • duan5731 2018-05-02 14:47

    In Swift a Character is an “extended grapheme cluster,” and each of "

    解决 无用
    打赏 举报

相关推荐 更多相似问题