通過提供的源代碼位置來判斷是9
。
C#代碼:
var res = s.Substring(0, 9) + s.Substring(9).Replace("?????", "xxxxx");
VB.NET:
Dim res As String = (s.Substring(0, 9) & s.Substring(9).Replace("?????", "xxxxx"))
例VB.NET:
Using sr As StreamReader = New StreamReader("a.txt")
Using sw As StreamWriter = New StreamWriter("b.txt")
Dim line As String = Nothing
Do While (Not line = sr.ReadLine Is Nothing)
Dim res As String = (line.Substring(0, 9) & line.Substring(9).Replace("?????", "xxxxx"))
sw.WriteLine(res)
Loop
End Using
End Using
例C#:
using (var sr = new StreamReader("a.txt"))
{
using (var sw = new StreamWriter("b.txt"))
{
string line = null;
while ((line = sr.ReadLine()) != null)
{
var res = line.Substring(0, 9) + line.Substring(9).Replace("?????", "xxxxx");
sw.WriteLine(res);
}
}
}
是否總是爲每個文件相同,或者它的文件之間有什麼不同?還有,問號總是一樣的嗎? – Nightfirecat
是的,它始終是相同數量的問題標記,並且始終顯示在同一個索引上(每行相同)。每個文件都是不同的,但格式是相同的......將每行的位置10中的5個問號替換爲xxxxx。 – Prabhu