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 134 views
1 answer 123 views
123 views asked Oct 31, 2019 by avibootz
2 answers 190 views
190 views asked Oct 31, 2019 by avibootz
1 answer 141 views
1 answer 128 views
1 answer 152 views
1 answer 162 views
...