Swift 2.0 裁剪字符串以及Int和String转化

来源:互联网 发布:ipadmini无法安装软件 编辑:程序博客网 时间:2024/06/10 14:29

swift 2.0

字符串裁剪:

let text = "1234567890" let t = text.startIndex.advancedBy(1)
text = text.substringFromIndex(t)//"234567890"

let t1 = text.endIndex.advancedBy(-1)
text = text.substringFromIndex(t)//"123456789"


Int To String:

let t = 12let s = t.description//s="12"

String To Int

let s = "12"let t = Int(s)//t=12

参考:

http://www.swiftmi.com/topic/76.html

0 0