|
■No62694 (スマホ さん) に返信
とりあえず、意味はあまりないが行単位で読んで、カンマ毎に区切って読む例です。
Dim aaa As String = "aaaaa,bbbbbb,ccccc,ddddddd,eeeeee,fffff" & Environment.NewLine & _
"ggggg,hhhhhh,iiiii,dddd" & Environment.NewLine & _
"jjjjj,kkkk,llll"
Dim rd As New StringReader(aaa)
Dim lineStr As String = rd.ReadLine
Do While lineStr IsNot Nothing
Dim Idx = lineStr.IndexOf(",")
Do While Idx >= 0
Dim ColValue = lineStr.Substring(0, Idx)
Console.Write("{0}:", ColValue)
If Idx + 1 < lineStr.Length Then
lineStr = lineStr.Substring(Idx + 1)
Else
lineStr = String.Empty
End If
Idx = lineStr.IndexOf(",")
Loop
Console.Write("{0}:", lineStr)
Console.WriteLine("LineEnd")
lineStr = rd.ReadLine
Loop
For分をDoで置き換え
For i = 0 to 10
For j = 0 to 10
処理(i,j)
Next
Next
i=0
Do While i<=10
j = 0
Do While j<=10
処理(i,j)
j += 1
Loop
i += 1
Loop
|