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 chars.

for example, have string:

var x = "hello, cruel world." 

then can index char:

var y = x[1]; 

at point y character 'e'.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

Python Tornado package error when running server -

Qt QGraphicsScene is not accessable from QGraphicsView (on Qt 5.6.1) -