943,786 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 897
  • VB.NET RSS
Feb 12th, 2009
0

Extract particular data from a css file

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
gladiator_jai is offline Offline
2 posts
since Feb 2009
Feb 13th, 2009
1

Re: Extract particular data from a css file

Have you tried just reading in the lines and splitting based on the "." and "{"?

VB Syntax (Toggle Plain Text)
  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.
Reputation Points: 23
Solved Threads: 10
Light Poster
bcasp is offline Offline
45 posts
since Apr 2008
Feb 14th, 2009
0

Re: Extract particular data from a css file

Thanks Man ...worked like a charm.
bless you
Reputation Points: 10
Solved Threads: 0
Newbie Poster
gladiator_jai is offline Offline
2 posts
since Feb 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: querying records
Next Thread in VB.NET Forum Timeline: Multi-Line Text Tool





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC