swfit 第二天(2)

/*************************************/

var a = "obdoc111"

if a.hasSuffix("112") {

    print("yes")

}else

{

    print("no")

}

/*************************************/

var a = "obdoc111"

if a.hasPrefix("obd") {

    print("yes")

}else

{

    print("no")

}

/*************************************/

var welcome = "hello"

welcome.insert("!", atIndex: welcome.endIndex)

print(welcome)

/*************************************/

var a: String"abc"

print(a.characters.count)

/*************************************/

var a = ""

if a.isEmpty

{

    print("a is empty!")

}

a = "ni hao"

var b = " ma"

var c = ""

c = a+b

print(c)

/*************************************/

 

var a = ""

if a.isEmpty

{

    print("a is empty!")

}

a = "ni hao"

for i in a.characters

{

    print(i)

}


 

var x: UInt = UInt.max

 

 

    print(x&+1)


 

var  (x,y) = (1,2)

y = x

 

if x==y

{

    print(x)

}


 

let (x,y) = (1,2)

print(x,y)


 

var a = -1 , b = 1 ,c=3

print (a==b ?b:c)

posted @ 2015-12-17 22:55  egai  阅读(114)  评论(0编辑  收藏  举报