/* 1.swift字符串和字符 2.构造字符串 3.字符串比较 4.数值运算 5.复制运算 6.关系运算 7.逻辑运算 8.区间运算 */ /* //数据 + 数据的处理 //字符信息+ 字符信息的处理 //char a = '张' //“hello” //const char * p = “hello” //char array[]= "hello" */ //var c:Character //c = "张" // //var b:String = "asdfa 张/U0001f496" //println(b) // // //var d = "abcd张" //println(count(d)) /*字符串构造 */ //let str1 = "hello" //let str2 = "word" //let str = str1+str2 // //var index = 9 //let message = "http://www.mobiletrain.org" // //let urlhead = "(message)/pic" // //println(urlhead) /* 字符串比较 */ let str = "hello" if str > "aello" { println(str) } let str1 = "apple" if str1.hasSuffix("le") { println(str1) } let str2 = "Apple" println(str1.lowercaseString) let str3 = "255" let d = str3.toInt()! println(d) /*区间运算: (a...b)1...3->1,2,3 */ for _ in 1...5{ println("hello") } for i in 1...5{ println(i) } for i in 1..<5{ println(i) }