let str = "hello"
// >= <= < > != 都可以啊
if str == "hello"
{
print(str)
}
if str < "heoo"
{
print(str)
}
if str < "heoo"
{
print(str)
}
let str1 = "apple"
@H_502_114@ // 判断是否含有前缀if str1.hasPrefix("ap")
{
print(str1)
}
@H_502_114@ // 判断是否含有后缀
if str1.hasSuffix("le")
{
print(str1)
}
@H_502_114@ // 转换为大写
let str2 = str1.uppercased()
@H_502_114@ // 转换为小写
let str3 = str2.lowercased();
print(str2)
print(str3)
let str4 = "255d"
@H_502_114@ // 这个不能用了啊 @H_502_114@ // let d:Int? = str4.toInt();
let d1:Int? = Int(str4);
@H_502_114@ // 强制解包失败 @H_502_114@ // let d2:Int! = Int(str4);
print("-------->")
print(d1)
@H_502_114@ // print(d2)