I am parsing an .ini file and I need to target an exact section. The .ini file looks like this and I am trying to target the section "2nd Section" and not continue on:
1st Section
item1
item2
item3
2nd Section
item1
item2
item3
3rd Section
item1
item2
item3
Here is the code I have so far to target the section header "1st String"
private static string ParseSataHeader(string sataHeader, string bcuFileName)
{
string strLine = "";
StreamReader myReader = new StreamReader(bcuFileName);
bool foundSection = false;
while (strLine !=null)
{
strLine = myReader.ReadLine();
if (strLine !=null)
{
if (String.Compare("2nd Section", strLine, StringComparison.OrdinalIgnoreCase) == 0)
sataHeader = strLine.Trim();
}
In VBS i know that you can do a RegExpression function in order to keep iterating until you find a string that is not indented. Any ideas?