What is the replacement for isDigit() for characters in Swift?

前端 未结 6 1114
失恋的感觉
失恋的感觉 2020-12-29 03:58

As mentioned in this post, before Xcode 6 Beta 4, one could use c.isDigit() and c.isAlpha() to find if c : Character was a digit or al

6条回答
  •  孤城傲影
    2020-12-29 04:32

    The "problem" is that a Swift character does not directly correspond to a Unicode code point, but represents an "extended grapheme cluster" which can consist of multiple Unicode scalars. For example

    let c : Character = "

提交回复
热议问题