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 117 views
2 answers 181 views
1 answer 119 views
1 answer 127 views
1 answer 163 views
1 answer 141 views
2 answers 169 views
...