How to get first three characters from a string in C#

1 Answer

0 votes
using System;

class Program
{
   static void Main() {
        string s = "c#-programming";
        
        string firstThree = s.Substring(0, 3);

        Console.WriteLine(firstThree);
    }
}




/*
run:

c#-

*/

 



answered Jun 7, 2021 by avibootz

Related questions

1 answer 225 views
1 answer 140 views
1 answer 157 views
1 answer 132 views
1 answer 83 views
...