The netizen asked, reading data from a text file (txt) and making a simple algorithm. The original questions of netizens are as follows,
The netizen's question is that all numbers are numbers, but it does not indicate whether there is only one row. Therefore, Insus. NET algorithm, whether to process text files with multiple lines, whether it is all numbers, whether it is included in a blank line, whether a row has only one number, whether the separator is in front or behind.
Therefore, Insus. NET provides the text file mentioned above as the algorithm object:
OK, Insus. NET prefers to create objects to deal with these problems. Because text files are stored in rows, rows are processed as objects. Logic processing:
Next, Insus. NET writes a number category to process the numbers between each separator (,) in each line.
You also need to create a category to obtain all qualified numbers.
Let's take a look at the result output webpage. Before the output result, we should write a program to read text files, get each line, and process the number of separators in each line. After the List <Number> set is obtained, it is convenient to convert it to int [] arr.
Result: