c# - What do the square brackets mean, when it is after a string, and not an array? -
what square brackets mean, when after string, , not array? (e.g. str[5] in following example)
string str; console.write("input string : "); str = console.readline(); console.writeline( (str.length < 6 && str.equals("hello")) || (str.startswith("hello") && str[5] == ' ') );
same thing means anywhere else. string is array (or @ least has indexer)... of char
s.
for example, have string:
var x = "hello, cruel world."
then can index char
:
var y = x[1];
at point y
character 'e'
.
Comments
Post a Comment