How to get the first 5 characters of string in C#

1 Answer

0 votes
using System;

class Program
{
    static void Main() {
        string str = "c# programming";

        Console.Write(str.Substring(0, 5));
    }
}




/*
run:

c# pr

*/

 



answered Aug 15, 2023 by avibootz

Related questions

1 answer 203 views
2 answers 333 views
1 answer 190 views
1 answer 203 views
1 answer 240 views
1 answer 216 views
2 answers 275 views
...