我如何在C#中读取字符串 [英] How can i read a string in C#
本文介绍了我如何在C#中读取字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何一个一个地读取字符串?
How can i read a string one one character?
推荐答案
使用string
中的索引器.
Use indexer from thestring
.
string str = "Welcome";
char i = str[3];
i
将保留''c''
.
i
will hold ''c''
.
Console.ReadLine();
string str = "example"
for (int i = 0; i < str.Length; i++)
{
MessageBox.Show(str[i].ToString());
}
这篇关于我如何在C#中读取字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文