复制文本文件中的最后20个字符并将其显示在消息框中 [英] Copy the Last 20 characters from a text File and show it in a Message Box
问题描述
我有一个文本文件为
1.asdasasd123123adasdasd ^^ asdasd ^^ 12345678901234567890
2.asdasasd123123adasdasd ^^ asdasdweqw ^^ aasa
-
-
依此类推.字符串"12345678901234567890"包含20个字符
在文本文件的第一行中
我只想捕获此字符串,即 12345678901234567890
第一行的长度可能会有所不同,但是此字符
始终包含20个字符.
我只需要捕获这20个字符串并显示
在消息框中.
能做完吗?
Assist
I have a text File as
1.asdasasd123123adasdasd^^asdasd^^12345678901234567890
2.asdasasd123123adasdasd^^asdasdweqw^^aasa
--
--
and so on .the String "12345678901234567890" contains 20 characters
which is in first line of the text file
I just want to capture this string that is 12345678901234567890
The length of the First line may vary accordingly but this character
always contain 20 characters.
I just need to capture this 20 character string and to show
in a message box.
Can it be Done.
Assist
推荐答案
是:
Using tr As TextReader = New StreamReader("D:\Temp\Data.txt")
Dim s As String = tr.ReadLine()
Dim bitYouWant As String = s.Substring(s.Length - 20)
Console.WriteLine(bitYouWant)
End Using
这篇关于复制文本文件中的最后20个字符并将其显示在消息框中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!