How to check user input for correct formatting

Posted by Arcadian on Stack Overflow See other posts from Stack Overflow or by Arcadian
Published on 2010-06-09T16:51:12Z Indexed on 2010/06/09 17:02 UTC
Read the original article Hit count: 161

Filed under:

This is what i've come up with so far

private void CheckFormatting()
    {
        StringReader objReaderf = new StringReader(txtInput.Text);
          List<String> formatTextList = new List<String>();

                 do
                     {
                         formatTextList.Add(objReaderf.ReadLine());
                     } 
                 while (objReaderf.Peek() != -1);

                 objReaderf.Close();
                 for (int i = 0; i < formatTextList.Count; i++)
                 {

                 } 
    }

What it is designed to do is check that the user has entered their information in this format Gxx:xx:xx:xx JGxx where "x" can be any integer.

As you can see the user inputs their data into a multi-line textbox. i then take that data and enter it into a list. the next part is where i'm stuck. i create a for loop to go through the list line by line, but i guess i will also need to go through each line character by character. How do i do this? or is there a faster way of doing it?

thanks in advance

© Stack Overflow or respective owner

Related posts about c#