|
-
January 3rd, 2012, 12:21 AM
#1
validation
I have a text file containing text in the form,
all the world ends in 10 days 2
sample line1
sample line 2
roger federer wins the tournament 3
sample line 1
sample line 2
sample line 3
In the about example, there are two types of lines,
1. starts without blank space
2. starts with blank space
all the world ends in 10 days 2
the last digit, i.e 2 should be extracted from each line which starts without a blank space (expedtedNoOfLines)
the number of lines which starts with a blank space should match expedtedNoOfLines
while((line = sr.ReadLine()) !=null)
{
if(!line.startswith(" "))
{
expectedLines = line.Substring(line.Length-1, 1);
}
else
{
actualLinesCount++;
}
if(expectedLines != actualLinesCount)
richTextEditor.SelectionColor = Color.Red;
else
richTextEditor.SelectionColor = Color.Black;
richTextEditor.text = line;
richTextEditor.text = System.Environment.NewLine;
}
The above code is not working.....any help?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|