swift 字符串,数组,字典 的那些事<三>

来源:互联网 发布:数据仓库软件有哪些 编辑:程序博客网 时间:2024/06/16 11:17

<三>字典

//声明一个空的dictionary


var dicTest:Dictionary<String,String>=Dictionary<String,String>()


dicTest=["一号种子":"vg","二号种子":"lgd","三号种子":"ehome"]


//取得一号种子


dicTest["一号种子"]


//更改一号种子

dicTest["一号种子"]="黑马ig"


//删除三好种子


dicTest.removeValueForKey("三号种子")


//遍历字典


for (key,value)in dicTest{


 println(key)

  

 println(value)


}


for keyin dicTest.keys{


   println(key)


}


for valuein dicTest.values{

   println(value)

}


0 0