在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
//字符串的替换 let ReplaceString = "http://www.aimonkey。cn" let FilterReplace = ReplaceString.replacingOccurrences(of: "。", with: ".") print(FilterReplace)
//字符串的删除 let str = ReplaceString.replacingOccurrences(of: "w", with: "") print(str)
//字符串的截取 //将ReplaceString 转换为OC 的字符串使用,根据范围来截取字符串 let subString1 = (ReplaceString as NSString).substring(with: NSMakeRange(1, 3)) print(subString1)
//截取下标2 之前的字符 let subString2 = (ReplaceString as NSString).substring(to: 2) print(subString2) //截取下标2 之后(含有2) let subString3 = (ReplaceString as NSString).substring(from: 2) print(subString3)
//字符串的分割 let url = "http://blog.csdn.net/hello_hwc?viewmode=list" let urled = url.components(separatedBy: "/") print(urled)
//字符串的拼接 let str = "Hello"
let str = String(format: "称呼 : %@", dic["firstName"]! as! CVarArg) |
请发表评论