如何回报这是该指数在字符? [英] how to return the character which is at the index?
本文介绍了如何回报这是该指数在字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道,我可以返回一个字符串的indexOf()函数的特定字符的索引。 但是,我怎么能与特定的索引返回字符?
解决方案
字符串s =你好;
焦炭C = S [1];
//现在ç=='E'
另请参见子串
,返回多个字符。
I know that i could return the index of a particular character of a string with indexof() function. But how i could return the character with the particular index?
解决方案
string s = "hello";
char c = s[1];
// now c == 'e'
See also Substring
, to return more than one character.
这篇关于如何回报这是该指数在字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文