为什么characters1不为空? var characters1 = CharacterSet.decimalDigitslet characters2 = CharacterSet(charactersIn: "01234567890")characters1.subtract(characters2)print(characters1.isEmpty) 一切都好 var characters1 = CharacterSet(
var characters1 = CharacterSet.decimalDigits let characters2 = CharacterSet(charactersIn: "01234567890") characters1.subtract(characters2) print(characters1.isEmpty)
一切都好
var characters1 = CharacterSet(charactersIn: "9876543210") let characters2 = CharacterSet(charactersIn: "0123456789") characters1.subtract(characters2) print(characters1.isEmpty)从 docs(强调我的)
Informally, this set is the set of all characters used to represent
the decimal values 0 through 9. These characters include, for example,
the decimal digits of the Indic scripts and Arabic.
因此,CharacterSet.decimalDigits不仅包含“9876543210”,它们还包含来自印度语脚本(和其他脚本)的数字.