ios - 如何将 String.UTF8View.Index 转换为 String.CharacterView.Index?

标签 ios iphone swift ios7 swift2

我正在快速处理字符串。但是当我想将 String.UTF8View.Index 转换为 String.CharacterView.Index 时,我遇到了一些麻烦。有人知道该怎么做吗?提前致谢!

最佳答案

使用以下初始化函数:

String.Index.init(utf8Index: UTF8Index##UTF8Index#>, within: <#T##String#>)

在这个函数中你必须使用字符串作为参数。

关于ios - 如何将 String.UTF8View.Index 转换为 String.CharacterView.Index?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34630386/

相关文章:

objective-c - 如何用加号 "+"替换空格

iphone - 将 .xib 与 Storyboard 一起使用时出现问题

android - Phonegap 网络连接 - 无法读取未定义的属性 'type'

ios - 如何在iOS中横向和纵向旋转图像?

iphone - iPhone 5s 上未安装应用程序

ios - 如何在TableViewController中保存对象

ios - 用户输入的 f(x) 可在 swift 中使用

swift - 检查 Swift 类是否符合协议(protocol)并实现可选功能?

ios - 从 UISearchController 搜索栏快速删除黑色边框

ios - 不是按字母顺序而是使用字符串前缀参数对数组进行排序