-
Function IsLike(strText As String, pattern
As String) As Boolean
IsLike =
strText Like pattern
End Function
Function IsChinese(strText As String)
As Boolean
Dim i%, h$$
h =
Hex(Asc(strText))
If Asc(Left(h, 1)) >=
66 And Asc(Left(h, 1)) <= 70 Then
IsChinese = True
End If
End Function
Function
StringType(strText As String, Optional outPutType
As Integer = 1, Optional sumVar As
Boolean = False) As Variant
Dim strtemp As String, blnArray(1 To 5)
As String, strPreType As Integer
Dim
intNum As Integer, startPos As Integer, intlen As
Integer
Dim strArray As Variant,
strCompare1 As String, strCompare2 As String,
dblSum As Double
If sumVar = True And
Not (outPutType <> 2 Or outPutType <> 4) Then
sumVar = False
For i = 1 To
Len(strText)
strtemp = Mid(strText, i,
1)
If i > 1 Then strCompare1 =
(Mid(strText, i - 1, 3))
strCompare2 =
(Mid(strText, i, 2))
If (strtemp) =
strtemp Then
strtemp = (strtemp)
If
IsLike(strtemp,
Or
IsLike(strCompare1,
Or
IsLike(strCompare2,
If
strPreType = 4 Then
blnArray(4) =
Left(blnArray(4), Len(blnArray(4)) - 1) & intNum
Else
intNum = 1
blnArray(4) = blnArray(4) &
End
If
strPreType = 4
intNum = intNum
+ 1
ElseIf IsLike(strtemp,
If strPreType = 5 Then
blnArray(5) = Left(blnArray(5),
Len(blnArray(5)) - 1) & intNum
Else
intNum = 1
blnArray(5) = blnArray(5) &
End
If
strPreType = 5
intNum = intNum
+ 1
ElseIf IsChinese(strtemp)
Then
If strPreType = 1 Then
blnArray(1) = Left(blnArray(1),
Len(blnArray(1)) - 1) & intNum