|
发表于 2008-9-15 17:08:10
|
显示全部楼层
开大空间,英文中文全支持...
我不保证内存会怎么样...
ClassTree
Option Explicit
Option Base 0
Private Point(255) As ClassTree
Public Ends As Boolean
Public Property Set Dic(ByVal Index As Integer, ByVal Tree As ClassTree)
Set Point(Index) = Tree
End Property
Public Property Get Dic(ByVal Index As Integer) As ClassTree
Set Dic = Point(Index)
End Property
Public Sub Add(ByRef s As String)
Dim i As Long, j As Long, t As ClassTree
Dim Buffer() As Byte
Buffer = StrConv(s, vbFromUnicode)
Set t = Me
For i = 0 To UBound(Buffer)
j = Buffer(i)
If t.Dic(j) Is Nothing Then Set t.Dic(j) = New ClassTree
Set t = t.Dic(j)
Next
t.Ends = True
End Sub
Public Function IsExists(ByRef s As String) As Boolean
Dim i As Long, j As Long, t As New ClassTree
Dim Buffer() As Byte
Buffer = StrConv(s, vbFromUnicode)
Set t = Me
For i = 0 To UBound(Buffer)
j = Buffer(i)
Set t = t.Dic(j)
If t Is Nothing Then Exit Function
Next
IsExists = t.Ends
End Function |
|