I have a string User name (sales) and I want to extract the text between the brackets, how would I do this?
User name (sales)
I suspect sub-string but I can\'t work out
Assuming that you only have one pair of parenthesis.
string s = "User name (sales)"; int start = s.IndexOf("(") + 1; int end = s.IndexOf(")", start); string result = s.Substring(start, end - start);