我从旧文件中抓取了文本,需要获取放置在字符串中的数字数据。
字符串看起来像:
"season: 1983 colony: 23 colony weight: 4 kg yeild: 12 kg
"season: 1983 colony:- colony weight: 5 kg yeild: 14 kg"
Run Code Online (Sandbox Code Playgroud)
我做了一个函数,它接受一个原始数据字符串并返回一个整数数组。
Function getClearBeeData(rawData As Variant) As Integer()
Dim retValue(4) As Integer 'array where each found number stored
Dim strTempString As String 'temporary string to hold current number
Dim i, k As Integer 'i counter for original string, k counter for array position
Dim token As Boolean 'token shows whether previous chars were number
token = False
For …Run Code Online (Sandbox Code Playgroud)