因此,我试图读取一个文件,并将索引设置为计数器,以便在文件中从一个字符移到另一个字符,以找到°s所在的索引。尽管我不知道出了什么问题,但我还是不断地得到IndexOutOfRangeException。
Dim chr As String
Dim c1 As String
Dim c2 As String
Dim c3 As String
Static index As Integer = -1
index += 1
chr = numDat(index)
While Asc(chr) <> 176
index += 1
chr = numDat(index)
End While我在chr =numDat(索引)中的索引处得到了错误。任何帮助都将不胜感激,谢谢!
编辑:我忘了提到numDat是一个已经读取了整个文件的字符串。
numDat = My.Computer.FileSystem.ReadAllText(path + fileName)发布于 2015-09-26 03:05:54
您可以找到这样的所有°事件:
numDat = My.Computer.FileSystem.ReadAllText(path + fileName)
Dim index As Integer = numDat.IndexOf("°")
While index <> -1
Debug.Print(index)
index = numDat.IndexOf("°", index + 1)
End Whilehttps://stackoverflow.com/questions/32792648
复制相似问题