How to get the first char from a string in C#

1 Answer

0 votes
using System;
 
class Program
{
    static void Main() {
        string s = "c# c c++ java";
 
        char first_char = s[0];
 
        Console.WriteLine(first_char);
    }
}
 
 

/*
run:
 
c
 
*/

 



answered Oct 31, 2019 by avibootz
edited Apr 16, 2024 by avibootz

Related questions

1 answer 229 views
1 answer 211 views
211 views asked Oct 31, 2019 by avibootz
2 answers 306 views
306 views asked Oct 31, 2019 by avibootz
1 answer 223 views
1 answer 210 views
1 answer 243 views
1 answer 260 views
...