I have a string:
string str = "abc = def; \r\n header \r\n { \r\n def"
In this string i want to get the string just before the character { i.e, "header".
I can get the index of { by
str.indexOf('{')
But how can we get the string just before '{' ?