0

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

2
Contributors
2
Replies
4
Views
8 Years
Discussion Span
Last Post by gladiator_jai
1

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

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

In my limited testing, that seems to give me what you were looking for.

Votes + Comments
Excellent
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.