质量为本、客户为根、勇于拼搏、务实创新
c#怎样获得字符串第一个字符
您可以通过以下方法获得字符串的第一个字符:
string str = "Hello"; char firstChar = str[0]; Console.WriteLine(firstChar); // 输出为 'H'
在C#中,字符串可以像数组一样使用索引来访问其中的字符,索引从0开始。因此,您可使用方括号和索引0来获得字符串的第一个字符。
tiktok粉丝购买:https://www.smmfensi.com/
TOP