Converting String to Int with Swift

前端 未结 30 1577
小鲜肉
小鲜肉 2020-11-22 06:59

The application basically calculates acceleration by inputting Initial and final velocity and time and then use a formula to calculate acceleration. However, since the value

30条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-22 07:21

    About int() and Swift 2.x: if you get a nil value after conversion check if you try to convert a string with a big number (for example: 1073741824), in this case try:

    let bytesInternet : Int64 = Int64(bytesInternetString)!
    

提交回复
热议问题