How this String split()[1] method work
I look at the String.Split()
method in MSDN which is different from the above. can someone help to explain how this work开发者_运维百科s?
string boundary = resp.Headers["Content-Type"].Split('=')[1];
What is that [1]
beside the .Split('=')[1]
means?
String.Split
returns an array.
Writing x[1]
, where x
is an array, gets the 2nd element in the array.
string dir = "Saina*is*good girl";
string parts = dir.Split('*')[1].ToString();
Console.Write(parts);
It will return 'is' as a answer
精彩评论