I have a string which contains so many lines in it.Now as per my requirement i have to search a substring(text) into this string and find out the line number in which this substring(text) exists in the string.
Once i will get the line number i have to read that line and get to know Which contents in it is Character and what is integer or digits.
This is the code that i am using to read a specific line ..
private static string ReadLine(string text, int lineNumber)
{
var reader = new StringReader(text);
string line;
int currentLineNumber = 0;
do
{
currentLineNumber += 1;
line = reader.ReadLine();
}
while (line != null && currentLineNumber < lineNumber);
return (currentLineNumber == lineNumber) ? line : string.Empty;
}
But how to search the line number which contain specific text(substring)?