0

だから私はファイルを読み込もうとしていて、カウンターとしてインデックスを設定しているので、ファイル内の文字から文字へと移動して、°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(index) のインデックスでエラーが発生しています。どんな助けでも大歓迎です、ありがとう!

編集: numDat は既にファイル全体を読み取った文字列であることを忘れていました。

numDat = My.Computer.FileSystem.ReadAllText(path + fileName)
4

1 に答える 1

0

°次のようなすべての出現を見つけることができます。

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 While
于 2015-09-26T03:05:54.213 に答える