Extract particular data from a css file

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Feb 2009
Posts: 2
Reputation: gladiator_jai is an unknown quantity at this point 
Solved Threads: 0
gladiator_jai gladiator_jai is offline Offline
Newbie Poster

Extract particular data from a css file

 
0
  #1
Feb 12th, 2009
Ok, here is the issue.

I have a xyz.css file which I read using the streamreader.

the file has text in the form

.Addfont { ......
.GridLayout {......
a.Master Layout {......

Now I need to extract the text between the '.' and '{'
In this case it would be
Addfont
GridLayout
Master Layout

How should I go about this.... I tried using the readline() method but it didn't work for the '{'

Please help me

Thank you
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 45
Reputation: bcasp is an unknown quantity at this point 
Solved Threads: 10
bcasp bcasp is offline Offline
Light Poster

Re: Extract particular data from a css file

 
1
  #2
Feb 13th, 2009
Have you tried just reading in the lines and splitting based on the "." and "{"?

  1. Dim streamRead as StreamReader = new StreamReader("xyz.css")
  2. Dim input As String = streamRead.ReadLine()
  3. Dim splitParams as String() = {".", "{"}
  4. Dim cssClass as String
  5. If input.StartsWith(".") Then
  6. cssClass = input.Split(splitParams, StringSplitOptions.RemoveEmptyEntries)(0).Trim()
  7. Else
  8. cssClass = input.Split(splitParams, StringSplitOptions.RemoveEmptyEntries)(1).Trim()
  9. End If

In my limited testing, that seems to give me what you were looking for.
Last edited by bcasp; Feb 13th, 2009 at 9:43 am.
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 2
Reputation: gladiator_jai is an unknown quantity at this point 
Solved Threads: 0
gladiator_jai gladiator_jai is offline Offline
Newbie Poster

Re: Extract particular data from a css file

 
0
  #3
Feb 14th, 2009
Thanks Man ...worked like a charm.
bless you
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the VB.NET Forum
Thread Tools Search this Thread



Tag cloud for VB.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC