How to convert a String (numeric) in a Int array in Swift

后端 未结 8 1432
鱼传尺愫
鱼传尺愫 2021-02-13 20:41

I\'d like to know how can I convert a String in an Int array in Swift. In Java I\'ve always done it like this:

String myString = \"123456789\";
int[] myArray = n         


        
8条回答
  •  别那么骄傲
    2021-02-13 21:06

    var myString = "123456789"
    var myArray:[Int] = []
    
    for index in 0..

    To get the iterator pointing to a char from the string you can use advance

    The method to convert string to int in Swift is toInt()

提交回复
热议问题