我怎么能迅速做同样的事情2:

String a = "danial";
  for (int i= 0 ; i < a.length() ; i++) {
    System.out.println(a.charAt(i));
  }
}

最佳答案

尝试这个 :

let myString = "danial"
let characters = Array(myString.characters)
print(characters) //OP : ["d","a","n","i","a","l"]
print(characters[0]) //OP : ["d"]

关于swift - 如何快速将单词分解为字符,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/32664401/

10-13 03:59