Read individual characters from a string

Treat the string as an array


	string MyString = "abcd";
	char MyChar = MyString[2];

Get Characters Between Markers Within String


	string sTemp = responseStr;
	string StartAfterChars;
	string EndBeforeChars;
	int Start;
	int Length;
	string FoundString;

	StartAfterChars = "<requestID>";
	EndBeforeChars = "</requestID>";
	Start = sTemp.IndexOf(StartAfterChars) + StartAfterChars.Length;
	Length = sTemp.IndexOf(EndBeforeChars) - Start;
	if ((Start > 0) && (Length > 0))
		FoundString = sTemp.Substring(Start, Length);
	else
		FoundString = "";

 

Feel free to comment if you can add help to this page or point out issues and solutions you have found. I do not provide support on this site, if you need help with a problem head over to stack overflow.

Comments

Your email address will not be published. Required fields are marked *