by @saigowthamr

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

Home » c-sharp » How to get first three characters from a string in C#

To get the first three characters from a string we can use the Substring() method by passing the 0,3 as an arguments.

Here is an example that gets the first 3 characters from a given string

 string mystring = "Hellopeople";
 string firstThree =  mystring.Substring(0,3);

 Console.WriteLine(firstThree);

Output:

Hel

Best Web Development courses