System.Generics.Collections.TDictionary
uses System.Generics.Collections;
...
var dicDoctionary: TDictionary<String, String> //Key, Value
//宣告
dicDoctionary := TDictionary<String, String>.Create;
//新增
dicDoctionary.Add(Key, Value);
//刪除
dicDoctionary.Remove(Key);
//新增或取代Value
dicDoctionary.AddOrSetValue(Key, Value);
//比對Key是否存在
dicDoctionary.ContainsKey(Key);
//比對Value是否存在
dicDoctionary.ContainsValue(Value);
//數量
dicDoctornary.Count;
//取值
var sValue:String;
dicDoctionary.TryGetValue(Key, sValue);
沒有留言:
張貼留言