func subString(fromIndex index: Int, endIndex: Int) -> String {
let start = self.index(self.startIndex, offsetBy: index)
let end = self.index(self.startIndex, offsetBy: endIndex)
return String(self[start...end])
}
func subString(fromIndex index: Int, endIndex: Int) -> String {
let start = self.index(self.startIndex, offsetBy: index)
let end = self.index(self.startIndex, offsetBy: endIndex)
return String(self[start...end])
}
本文标题:Swift 字符串截取方法 --- 分类中实现
本文链接:https://www.haomeiwen.com/subject/afsikctx.html
网友评论