本文介绍了将字符串转换为迅速2.0字符数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要一个字符串转换成字符数组。这项工作在斯威夫特为1.2或更低,但不会因为雨燕2.0
VAR的myString =你好
阵列(MyString的)// [H,E,L,L,O]
解决方案
VAR的myString =你好
让字符= [性状](myString.characters)// [H,E,L,L,O]
希望这有助于
I need to convert a string into an array of characters. This work in Swift 1.2 and lower but doesn't since Swift 2.0
var myString = "Hello"
Array(myString) // ["H", "e", "l", "l", "o"]
解决方案
var myString = "Hello"
let characters = [Character](myString.characters) // ["H","e","l","l","o"]
Hope this helps
这篇关于将字符串转换为迅速2.0字符数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!