How to get substring from beginning of a string in C#

1 Answer

0 votes
using System;

class Program
{
    static void Main() {
        string str = "c-sharp c c++ java php go";
    
        string substring = str.Substring(0, 9);  
        
        Console.WriteLine(substring);
    }
}



 
/*
run:

c-sharp c

*/

 



answered Aug 1, 2023 by avibootz
...