/// <summary> /// 添加关键字 /// </summary> /// <param name="key"></param> public void AddKey(string key) { if (string.IsNullOrEmpty(key)) { return; } TrieNode node = this; for (int i = 0; i < key.Length; i++) { char c = key[i]; node = node.Add(c); } node.m_end = true; }
/// <summary> /// 添加关键字 /// </summary> /// <param name="key"></param> public void AddKey(string key) { if (string.IsNullOrEmpty(key)) { return; } TrieNode node = this; for (int i = 0; i < key.Length; i++) { char c = GetSimp(key[i]); fastCheck[c] |= (1 << i); node = node.Add(c); } node.m_end = true; }