How to get substring of N characters from specific index in a string with C#

1 Answer

0 votes
using System;

class Program
{
    static void Main() {
        string s = "c# c++ c vb.net java python";  
        
        int startIndex = 3; 
        int N = 12;

        string subs = s.Substring(startIndex, N);    
        Console.WriteLine(subs);
    }
}



/*
run:

c++ c vb.net

*/

 



answered Feb 24, 2021 by avibootz
...