swift 3.0字符串的简单使用

  let str:String = "12314124"

获取某个指定位置的元素

        print(str.characters[str.index(str.startIndex, offsetBy: 2)])

从某个位置开始到另一个位置的字符串截取

        print(str.substring(to: str.index(str.startIndex, offsetBy: 3)))

转载于:https://my.oschina.net/wayzhu/blog/857825

原文地址:https://www.cnblogs.com/twodog/p/12141074.html