//字符串和字符
//1.定义
let str2 = "hellow"
let str3 = "hellow world"
let str4 = "w"
let str5 = "y"//单个字符,多个或没有会报错
//2.字符串比较==
if str2 == str3{
println("\(str2)与\(str3)是相等的")
}else{
println("\(str2)与\(str3)是不相等的")
}
//3.判断后缀是否相等
if str2.hasSuffix(str4){
println("\(str2)的后缀是\(str4)")
}
//4.判断前缀是否相等
if str3.hasPrefix(str2){
println("\(str3)的前缀是\(str2)")
}