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 -

reflection - How to access the object-members of an object declaration in kotlin -

php - Doctrine Query Builder Error on Join: [Syntax Error] line 0, col 87: Error: Expected Literal, got 'JOIN' -