📄 module1.bas
字号:
Attribute VB_Name = "Module1"
Public BID(1 To 100) As Long
'Public lyth(1 To 10) As Double
'***********************************************
'字符串转数组
'************************************************
Public Sub strdata(SS As String, data() As Double)
Dim icount As Integer
Dim i As Integer
Dim ifoundpos As Integer
Dim sss As String
i = 1
Const SPACECHAR = " "
icount = 1
ifoundpos = InStr(1, SS, " ")
Do While ifoundpos <> 0
sss = Mid$(SS, icount, ifoundpos - icount)
'sts(i) = sss
data(i) = Val(sss)
icount = ifoundpos + 1
ifoundpos = InStr(icount, SS, " ")
i = i + 1
Loop
If icount < Len(SS) Then
'sts(i) = Mid$(ss, icount)
data(i) = Val(Mid$(SS, icount))
End If
End Sub
'***********************************************
'字符串转字符传组
'************************************************
Public Sub strstrs(SS As String, sts() As String)
Dim icount As Integer
Dim i As Integer
Dim ifoundpos As Integer
Dim sss As String
i = 1
Const SPACECHAR = " "
icount = 1
ifoundpos = InStr(1, SS, " ")
Do While ifoundpos <> 0
'sss = Mid$(ss, icount, ifoundpos - icount)
sts(i) = Mid$(SS, icount, ifoundpos - icount)
' stsl(i) = ifoundpos - icount
'data(i) = Val(sss)
icount = ifoundpos + 1
ifoundpos = InStr(icount, SS, " ")
i = i + 1
Loop
If icount < Len(SS) Then
sts(i) = Mid$(SS, icount)
'data(i) = Val(Mid$(ss, icount))
End If
End Sub
Public Sub strinsert(SS As String, replacestr As String, N As Integer)
Dim icount As Integer
Dim i As Integer
Dim ifoundpos As Integer
Dim sss As String
i = 1
Const SPACECHAR = " "
icount = 1
ifoundpos = InStr(1, SS, " ")
Do While ifoundpos <> 0
If i = N Then
Mid(SS, icount) = replacestr
End Sub
Else
icount = ifoundpos + 1
ifoundpos = InStr(icount, SS, " ")
i = i + 1
End If
Loop
If icount < Len(SS) Then
If i = N Then
Mid(SS, icount) = replacestr
End If
End If
End Sub
'***********************************************
'数组转字符串
'************************************************
Public Sub datastostr(SS As String, datas() As Variant, datanum As Integer)
SS = ""
Dim i As Integer
i = 1
For i = 1 To datanum
SS = SS + Str(datas(i))
Exit For
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -