-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy pathQuickList.cs
57 lines (49 loc) · 1.31 KB
/
QuickList.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DigitalPlatform.Text
{
public class QuickList
{
string m_strText = "";
Hashtable m_table = new Hashtable();
public string Text
{
get
{
return m_strText;
}
set
{
this.m_strText = value;
BuildTable(value);
}
}
// 创建Hashtable
void BuildTable(string strText)
{
this.m_table.Clear();
string[] parts = strText.Split(new char[] {','});
foreach (string s in parts)
{
string strPart = s.Trim();
if (string.IsNullOrEmpty(strPart) == true)
continue;
this.m_table[strPart.ToLower()] = true;
}
}
public bool IsInList(string strSub)
{
if (string.IsNullOrEmpty(strSub) == true)
return false;
strSub = strSub.Trim();
if (string.IsNullOrEmpty(strSub) == true)
return false;
if (this.m_table.Contains(strSub.ToLower()) == true)
return true;
return false;
}
}
}