由网友(我是妳的稻草人)分享简介:我知道,我可以返回一个字符串的indexOf()函数的特定字符的索引。但是,我怎么能与特定的索引返回字符?解决方案 字符串s =你好;焦炭C = S [1];//现在ç=='E'另请参见子串,返回多个字符。I know that i could return the index of a particular...![12年上涨11倍的指数,目前仍然低估](https://p.xsw88.cn/allimgs/daicuo/20230904/8185.png)
我知道,我可以返回一个字符串的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?
解决方案![12年上涨11倍的指数,目前仍然低估](https://p.xsw88.cn/allimgs/daicuo/20230904/8185.png)
string s = "hello";
char c = s[1];
// now c == 'e'
See also Substring
, to return more than one character.
相关推荐
最新文章