16,721
社区成员




Public Sub ReadFileSample()
'打开程序当前路径下的config.txt文件
'内容就是楼主贴出来的
Dim reader As TextReader = File.OpenText("config.txt")
Dim line As String = reader.ReadLine() '读第一行
line = reader.ReadLine() '读第二行
line = reader.ReadLine() '读第三行
Dim n As Integer = 3 '当前行号
While line <> "" And n < 50
line = reader.ReadLine() '读下一行
n = n + 1
End While
Dim items As String() = line.Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries)
For Each item As String In items
Console.WriteLine(item)
Next
End Sub
diamond 4 09050120_027时效(09050223)T639GSI_2米温度(NMC-NWP)
09 05 01 12 027 2 1.000000 1.000000 0.00 180.00 0.00 90.00 181
91 4.00 -16.00 44.00 2 0.00
12.36 20.92 18.75 27.19 25.64 17.74 24.24 20.10 23.22 24.18
26.50 24.89 25.65 24.60 24.23 25.31 25.38 25.78 26.26 26.38
27.22 26.68 27.37 27.78 27.26 27.85 26.95 25.92 26.65 23.86
22.74 21.50 23.57 24.11 22.76 23.00 20.03 16.93 22.89 26.54
25.66 26.13 27.14 27.64 14.45 26.49 24.82 17.25 23.36 17.90
16.91 21.79 20.61 16.08 15.81 20.12 16.97 22.24 14.03 23.50
25.84 25.88 26.08 22.02 20.41 22.59 23.68 17.68 23.63 25.01
14.54 25.63 24.27 15.96 22.43 17.32 15.89 11.63 11.08 9.87
20.25 25.38 21.14 18.49 18.00 21.97 19.44 22.57 24.78 24.17
20.20 16.79 13.74 18.94 25.42 18.78 13.55 15.81 21.63 12.89
21.31 24.04 23.45 24.27 24.81 17.87 27.10 21.57 21.54 15.94
24.10 24.17 25.28 22.95 23.28 23.39 24.03 22.52 26.55 28.03
21.23 13.87 13.88 16.68 25.89 19.70 23.20 19.47 18.46 22.80
26.42 26.23 23.57 22.99 17.34 17.40 19.67 18.64 17.19 15.77
22.04 20.21 18.12 19.18 22.57 26.16 26.40 23.97 20.71 27.02
12.28 18.95 25.38 18.97 12.80 13.62 21.91 25.77 18.18 12.85
22.84 14.80 11.66 21.32 18.44 17.12 13.10 18.30 16.07 15.29
12.25 27.62 24.91 21.56 19.87 18.48 17.43 13.07 17.44 16.86
17.04
15.70 27.07 10.59 19.66 25.27 17.44 15.55 22.06 21.70 20.84
26.06 24.63 25.37 25.85 25.34 25.38 25.38 25.87 29.11 27.90
27.93 27.26 27.73 27.63 27.58 27.38 27.10 27.04 27.07 27.50
24.90 23.33 22.57 24.28 24.49 19.97 25.94 19.40 23.82 26.58
26.26 26.47 26.23 26.02 24.69 24.96 24.32 23.41 8.58 10.92
21.73 12.33 21.57 14.96 18.55 23.03 18.21 25.43 18.26 25.74
23.80 20.31 20.35 23.85 23.26 27.10 21.32 26.32 21.44 25.30
11.79 19.28 20.53 11.86 24.58 25.31 21.93 12.20 10.49 10.68
22.42 26.67 23.61 20.11 25.12 23.91 16.03 18.65 23.44 22.68
15.39 23.80 23.25 17.37 20.89 17.96 12.22 17.64 20.25 21.54
23.43 24.02 23.82 23.51 18.31 19.17 26.81 21.43 27.02 23.44
23.28 23.67 23.19 24.18 21.96 22.16 21.71 24.38 25.98 29.30
23.64 22.44 21.57 23.00 22.00 24.33 27.36 19.83 24.85 19.09
20.36 19.05 20.83 21.56 26.71 24.52 12.20 12.97 16.12 20.51
16.97 18.52 18.55 20.75 20.22 18.68 24.55 18.38 18.04 23.50
17.10 19.70 16.19 12.05 17.90 17.21 21.43 18.27 20.87 14.79
14.54 19.25 19.49 25.01 15.42 23.63 8.88 14.03 17.84 18.92
20.35 25.92 24.91 24.26 23.61 21.58 13.77 15.14 20.20 17.33
17.22
14.67 23.50 11.97 9.93 23.68 28.27 15.88 16.96 22.92 16.74
26.88 24.75 25.25 25.44 26.14 27.16 27.13 27.27 26.41 27.80
29.75 28.48 27.74 28.27 27.77 27.17 26.90 26.66 26.87 26.51
26.02 24.04 26.19 25.49 25.03 22.03 26.92 22.04 23.84 23.73
23.69 25.46 25.21 25.62 25.93 22.58 25.62 20.42 14.41 18.97
20.99 13.50 15.94 19.92 12.33 17.75 18.78 21.47 26.01 22.47
13.82 19.20 15.98 16.66 25.63 26.39 13.04 17.01 26.13 25.46
10.50 13.84 18.23 11.70 26.10 19.65 18.00 21.37 15.99 11.41
22.22 24.42 21.17 19.21 24.95 22.18 15.06 20.04 27.54 25.59
15.37 25.08 25.27 11.82 14.37 12.54 11.33 10.67 16.82 18.80
23.35 25.51 21.61 23.21 20.93 19.31 20.56 22.03 21.16 22.45
17.93 11.92 22.38 23.81 23.73 21.13 22.47 24.27 23.47 21.68
22.87 17.42 19.54 19.40 19.74 25.48 19.69 23.80 19.17 10.74
13.67 14.20 23.35 16.52 24.91 23.71 15.77 8.62 12.97 19.42
14.51 17.36 17.08 19.01 13.71 11.78 27.43 17.53 19.91 23.26
25.33 23.55 11.68 18.26 23.34 22.27 17.45 16.39 23.16 18.94
20.49 23.48 20.22 19.51 20.26 19.91 8.83 15.99 18.38 18.83
21.69 24.34 21.54 20.19 21.45 21.70 20.35 20.31 18.25 22.67
23.35
public function GetValueFromString(SourceString as string,FromIndex as Integer,FromLine as Integer) as string
Try
dim tm as string=""
dim Lines() as string=SourceString.Split(vbCrLf)
For I as integer=FromLine to Lines.Length-1
tm &= Lines(i)
Next
While tm.Contains(" ")=True
tm=tm.Replace(" "," ")
End While
Return tm.Split(" ")(FromIndex)
Catch
End Try
End Function
dim S as string="你的数据"
'-----移除多余空格
Do While S.Contains(" ")=True
S=S.Replace(" "," ")
Loop
'-----
Console.WriteLine(S.Split(" ")(50))