C# parsing a text file and storing the values in an array

前端 未结 3 2084
北恋
北恋 2021-01-23 13:58

I am trying to read in a text file which has this format below, into an array:

Previous errors were for Test id \'1234567\' Error id \'12345678\'
Previous errors         


        
3条回答
  •  臣服心动
    2021-01-23 14:07

    Use Regex.Split() if you want the text use

    string pattern = @"\d+";

    if you want the numbers use:

    pattern = "[a-z]+";
    

    then

    string[] extracted = Regex.Split(sr.Readline(), pattern, RegexOptions.IgnoreCase);

提交回复
热议问题