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 224 views
1 answer 139 views
1 answer 156 views
1 answer 131 views
1 answer 82 views
...