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 139 views
1 answer 133 views
133 views asked Oct 31, 2019 by avibootz
2 answers 194 views
194 views asked Oct 31, 2019 by avibootz
1 answer 146 views
1 answer 134 views
1 answer 157 views
1 answer 167 views
...