0
I am loading a text file in a string [], later making a split because the file is separated by spaces, but I noticed that lines are with different sizes, this is hindering the capture of positions in each one of the lines of the file, in the example code, I can only capture the text of position 65, when in fact the correct position was 231 until 239, the file in Notepad is correct, however, inside the code not.
public static string CarregaTxt()
{
string[] array = File.ReadAllLines(@"C:\Users\aoliveira\source\repos\BRR23120.ret");
string resultado = "";
for (int i = 0; i < array.Length; i++)
{
resultado = array[i];
string[] returnDataSplited = resultado.Split(' ');
string code = returnDataSplited[65];
var data = GetReturnMessage(code);
Console.WriteLine(resultado);
}
return resultado.ToString();
}
Add at least the sample data line where you find the error and another where it is correct.
– tvdias