J
joshua_jia
Unregistered / Unconfirmed
GUEST, unregistred user!
谁能帮忙将下面VB函数翻译成DELPHI,谢了
Function ShowMc(aa As String, b As String, c As String, d As String) As String
Dim slen As Integer
Dim adress As Integer '数据基地址
Dim sum As Integer '字段的个数
Dim tag As String '字段标识符
Dim middle As String '目次区内容
Dim data As String '数据区内容
Dim xx As Variant '数据字段数组
Dim zz As Variant '数据子字段数组
Dim x As Integer
Dim jsq As Integer '记数器
Dim temp As Variant '临时数组
Dim start As String
Dim finish As String
slen = Val(Mid(aa, 1, 5))
adress = Val(Mid(aa, 13, 5))
'sum = (adress - 24) / 12
middle = Mid(aa, 25, adress - 24 - 1)
data = Mid(aa, adress, slen - adress + 1)
x = 1
jsq = 1
tag = ""
temp = Split(data, Chr(30))
sum = UBound(temp)
While jsq <= sum
tag = Mid(middle, x, 3) ' 字段标识符
If tag = b Then
xx = Split(data, Chr(30)) '数据字段数组
start = InStr(1, xx(jsq), c) '子字段起始地址
finish = InStr(start + 1, xx(jsq), "$" '子字段结束地址
If finish < start Then
d = Mid(xx(jsq), start + 2, Len(xx(jsq)) - start - 1) '当该子字段为字段最后子字段时的内容
Else
d = Mid(xx(jsq), start + 2, finish - start - 2) '子字段内容
End If
End If
jsq = jsq + 1
x = x + 12
Wend
End Function
Function ShowMc(aa As String, b As String, c As String, d As String) As String
Dim slen As Integer
Dim adress As Integer '数据基地址
Dim sum As Integer '字段的个数
Dim tag As String '字段标识符
Dim middle As String '目次区内容
Dim data As String '数据区内容
Dim xx As Variant '数据字段数组
Dim zz As Variant '数据子字段数组
Dim x As Integer
Dim jsq As Integer '记数器
Dim temp As Variant '临时数组
Dim start As String
Dim finish As String
slen = Val(Mid(aa, 1, 5))
adress = Val(Mid(aa, 13, 5))
'sum = (adress - 24) / 12
middle = Mid(aa, 25, adress - 24 - 1)
data = Mid(aa, adress, slen - adress + 1)
x = 1
jsq = 1
tag = ""
temp = Split(data, Chr(30))
sum = UBound(temp)
While jsq <= sum
tag = Mid(middle, x, 3) ' 字段标识符
If tag = b Then
xx = Split(data, Chr(30)) '数据字段数组
start = InStr(1, xx(jsq), c) '子字段起始地址
finish = InStr(start + 1, xx(jsq), "$" '子字段结束地址
If finish < start Then
d = Mid(xx(jsq), start + 2, Len(xx(jsq)) - start - 1) '当该子字段为字段最后子字段时的内容
Else
d = Mid(xx(jsq), start + 2, finish - start - 2) '子字段内容
End If
End If
jsq = jsq + 1
x = x + 12
Wend
End Function