概述
String字符串的常用方法。
SCString
1import Foundation 2 3// MARK: - 字符串 4extension String { 5 6 /** 7 字符串截取,从头开始 8 9 :param: endIndex 从头开始截取,到哪一个索引号结束 10 11 :returns: 截取后的字符串 12 */ 13 func subString(let endIndex:Int)->String{ 14 15 let startIndex = self.startIndex 16 let index = advance(startIndex, endIndex) 17 return self.substringToIndex(index) 18 } 19 20 21 /// 字符串的长度 22 var length: Int { 23 return count(self) 24 } 25 26}
Git地址
http://devonios.com/go/swiftcommon
tips:
本文由wp2blog导入,原文链接:http://devonios.com/scstring.html