我是靠谱客的博主 难过抽屉,这篇文章主要介绍ios swift String遍历 Int Character,现在分享给大家,希望可以做个参考。

        let str = "123456"
        for i in str {
            let str1 = "" + String(i)
            print(str1)
            let num: Int = Int(str1)!+10
            print(num)
        }

打印:
1
11
2
12
3
13
4
14
5
15
6
16

        let str = "123456"
        for i in str.utf8 {
            print(i)//Int
            print(i+100)
        }

打印:
49
149
50
150
51
151
52
152
53
153
54
154

最后

以上就是难过抽屉最近收集整理的关于ios swift String遍历 Int Character的全部内容,更多相关ios内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(56)

评论列表共有 0 条评论

立即
投稿
返回
顶部