最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

[已解决]swift 如何操作字典变量

Swift crifan 2148浏览 0评论
想要给字典变量:
[String:String]
添加元素
但是不知道如何操作。
搜:
swift dictionary
参考:
最后是直接操作:
        var latestCharPinyinDict:[String:String] = oldCharPinyinDict

for eachCharPinyinDict in translatedCharPinyinDictList {
//get first==only one, dict value
let (charKey, pinyinValue) = eachCharPinyinDict.first!

if !latestCharPinyinDict.keys.contains(charKey) {
//add into dict

                latestCharPinyinDict[charKey] = pinyinValue
即:
someDict[someKey] = valueToSet
更多内容,可参考:

转载请注明:在路上 » [已解决]swift 如何操作字典变量

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
84 queries in 0.195 seconds, using 22.01MB memory