How to get the second digits from a string in C#

1 Answer

0 votes
using System;
using System.Text.RegularExpressions;

namespace ConsoleApplication_C_Sharp
{
    static class Program
    {
        static void Main()
        {
            string s = "C# 13 Java 89 Python";
            Match match = Regex.Match(s, "\\d");

            if (match.Success)
                Console.WriteLine(match.Value);

            match = match.NextMatch();

            if (match.Success)
                Console.WriteLine(match.Value);
        }
    }
}


/*
run:
  
1
3
   
*/

 



answered Oct 13, 2018 by avibootz

Related questions

1 answer 172 views
1 answer 148 views
1 answer 194 views
3 answers 143 views
1 answer 177 views
2 answers 147 views
...