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 -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -