locked
CS0103_The name 'you' does not exist in the current context_ RRS feed

  • Question

  • {
                string test = "Hello, how are youyou you, you you yy?";
                int wordCount = 0;
                int charCount = 0;

                foreach (Match m in Regex.Matches(test, you))
                {
                    wordCount++;
                }
                foreach (char value in test)
                {
                    if (value == 'y')
                    {
                        charCount++;
                    }
                }
                Console.WriteLine("wordCount: {0}", wordCount);
                Console.WriteLine("character count: {0}", charCount);
            }
    Thursday, June 4, 2015 12:13 PM

Answers

  • Thanks for any potential help but i found out what the problem was,

    foreach (Match m in Regex.Matches(test, "you")) the you needs double quotes  "you"

    Thursday, June 4, 2015 12:29 PM

All replies

  • Thanks for any potential help but i found out what the problem was,

    foreach (Match m in Regex.Matches(test, "you")) the you needs double quotes  "you"

    Thursday, June 4, 2015 12:29 PM
  • I am glad you figured the problem out as this forum is the the Small Basic compiler; you would not have found the answer here.

    Although, regular expressions would be a nice addition to SB... Hmmm.....

    Thursday, June 4, 2015 1:18 PM
    Answerer
  • It is: LDRegEx

    'No extension''s only for 'Monthly challenges'.

    Thursday, June 4, 2015 1:45 PM
    Answerer