Compare extracted information from multiple files.
Ok, stay with me on this one.
I have a bunch of css files with classes defined in them.
They are like this:
.toolbar{......}
.addpage{......}
I have managed to extract the just the classnames with a bit of help from a fellow member.
now i have another bunch of .vb, .aspx files which use these css classes in them. they in the form:
Now I have to extract the classnames after the 'cssClass' key word and then compare all the classnames with the previously extracted ones and determine which Classes are not being used. any help/pointers/suggestion will be appreciated.
Thanks a lot.
Vimal KandasamyPosted Feb 20, 2009, 7:16 AM
first of all, extract all css classes and store it an array or a temp file...
[to extract from a bunch of files, store all filepaths in a array and read them one by one using a for loop and store css classes]
After that extract all css classes which are used in files
and store them in a array....
[same as css file extraction]
following code will help you to extract class name after cssClass keyword as you specified
StreamReader x = new StreamReader("xyz.aspx");
int count=0;
String[] cssclass;
while(!x.EndOfStream)
{
String line = x.ReadLine();
String keyw="cssClass";
if(line.IndexOf(keyw)!=-1)
{
// find the starting possition of css class
int start = line.IndexOf(keyw)+keyw.Length;
// find the ending position of css class
int end=line.IndexOf('.');
cssclass[count++] = line.Substring(start+1, (end - start)-1);
}
}
after that compare both list of classes by comparing arrays....
i think this will help you