swift常用字符串处理

 

//: Playground - noun: a place where people can play

import UIKit

var str = "Hello"

var newString = str + "Lucy"

var newTypeString = NSString(string: newString)

newTypeString.substringFromIndex(5)

newTypeString.substringToIndex(5)

newTypeString.substringWithRange(NSRange(location: 3, length: 5))

if newTypeString.containsString("Lucy"){
  print("Hi")
}

newTypeString.componentsSeparatedByString("o")

newTypeString.uppercaseString

newTypeString.lowercaseString

 

posted @ 2016-01-14 21:05  冰凌花花~  阅读(128)  评论(0编辑  收藏  举报