swift Dictionaries字典操作示例代码

代码语言:swift

所属分类:其他

代码描述:swift Dictionaries字典操作示例代码

代码标签: 操作 示例

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

var someDict:[Int:String] = [1:"One", 2:"Two", 3:"Three"]
var someVar = someDict[1]

print( "Value of key = 1 is \(someVar)" )
print( "Value of key = 2 is \(someDict[2])" )
print( "Value of key = 3 is \(someDict[3])" )

//修改
var oldVal = someDict.updateValue("New value of one", forKey: 1)


print( "Old value of key = 1 is \(oldV.........完整代码请登录后点击上方下载按钮下载查看

网友评论0