dongse5528 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 "

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?