c#字符串中的某个特定位置的字符

string str = "Hello, World!";
char character = str[6]; // 取索引为6的字符,结果为'W'
Console.WriteLine(character); // 输出: W

  

string s = "011101";
s[i] == '0';//i为字符的位置

 

字符串长度 

string example = "Hello, World!";
int length = example.Length;
Console.WriteLine(length); // 输出:13

  

posted @ 2024-05-01 19:02  yinghualeihenmei  阅读(26)  评论(0编辑  收藏  举报