欢 迎 光 临 大海的风's BLog

 ||  

 管理员登陆

 这就是我
  • 日志:363
  • 评论:101
  • 留言:4
  • 访问:

最新公告

本人主要开发过软件有:
<<工厂生产管理系统>>
<<人事管理系统>>
<<货仓管理系统>>
<<发票管理系统>>
<<智能IC卡考勤管理系统>>
<<智能IC卡门禁考勤管理系统>>
<<指文门禁考勤管理系统>>
<<智能巡检管理系统>>
<<酒楼点菜收银系统>>等

站点日历
<<  < 2006 - >  >>
    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
最新日志
最新回复
最新留言
 日志搜索

友情链接
Powered By ShineBlog.com
 其他信息
·快速字符串压缩     -|fhbmonkey 发表于 2006-8-9 10:13:00

Private b1() As Byte
Private b2() As Byte


Public Function Simil(String1 As String, String2 As String) As Double
Dim l1 As Long
Dim l2 As Long
Dim l As Long
Dim r As Double


If UCase(String1) = UCase(String2) Then
r = 1
Else
l1 = Len(String1)
l2 = Len(String2)


If l1 = 0 Or l2 = 0 Then
r = 0
Else
ReDim b1(1 To l1): ReDim b2(1 To l2)


For l = 1 To l1
b1(l) = Asc(UCase(Mid(String1, l, 1)))
Next


For l = 1 To l2
b2(l) = Asc(UCase(Mid(String2, l, 1)))
Next
r = SubSim(1, l1, 1, l2) / (l1 + l2) * 2
End If
End If
Simil = r
Erase b1
Erase b2
End Function


Private Function SubSim(st1 As Long, end1 As Long, st2 As Long, end2 As Long) As Long
Dim c1 As Long
Dim c2 As Long
Dim ns1 As Long
Dim ns2 As Long
Dim i As Long
Dim max As Long
If st1 > end1 Or st2 > end2 Or st1 <= 0 Or st2 <= 0 Then Exit Function


For c1 = st1 To end1


For c2 = st2 To end2
i = 0


Do Until b1(c1 + i) <> b2(c2 + i)
i = i + 1


If i > max Then
ns1 = c1
ns2 = c2
max = i
End If
If c1 + i > end1 Or c2 + i > end2 Then Exit Do
Loop
Next
Next
max = max + SubSim(ns1 + max, end1, ns2 + max, end2)
max = max + SubSim(st1, ns1 - 1, st2, ns2 - 1)


SubSim = max
End Function

 

[阅读全文 | 回复(1) | 引用通告 | 编辑]

·Re:快速字符串压缩     -|路过(游客)发表评论于2007-12-10 22:24:00
版主这个怎么解压啊?
[个人主页 | 引用 | 返回 | 删除 | 回复]

发表评论:

    大名:
    密码: (游客无须输入密码)
    主页:
    标题:
    正在载入数据,请稍候……
Email:fhbmonkey@sohu.com QQ:76111951   大海的风