471,339 Members | 1,280 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,339 software developers and data experts.

String.Split function's limitation?

I'm trying to break this html statement at the "<!---->"

<br><a href='www.link1.com'>Link1</a><!----><br><a
href='www.link2.com'>Link2</a><!----><br><a
href='www.link3.com'>Link3</a><!---->

If I use string.split command, it splits based on the first "<" in "<!---->"
and not the whole <!---->. It works fine with single delimter like commas,
colons etc.. Is there another way to do this?

Thanks for your help.

V
Jul 21 '05 #1
4 3108
Use a regular expression.

"Varad" <va******@gmail.com> wrote in message
news:EC**********************************@microsof t.com...
I'm trying to break this html statement at the "<!---->"

<br><a href='www.link1.com'>Link1</a><!----><br><a
href='www.link2.com'>Link2</a><!----><br><a
href='www.link3.com'>Link3</a><!---->

If I use string.split command, it splits based on the first "<" in "<!---->" and not the whole <!---->. It works fine with single delimter like commas,
colons etc.. Is there another way to do this?

Thanks for your help.

V

Jul 21 '05 #2
Hi Peter,
Can you give me some hints on how to do regular expressions in my case?

Thanks.

"Peter Rilling" wrote:
Use a regular expression.

"Varad" <va******@gmail.com> wrote in message
news:EC**********************************@microsof t.com...
I'm trying to break this html statement at the "<!---->"

<br><a href='www.link1.com'>Link1</a><!----><br><a
href='www.link2.com'>Link2</a><!----><br><a
href='www.link3.com'>Link3</a><!---->

If I use string.split command, it splits based on the first "<" in

"<!---->"
and not the whole <!---->. It works fine with single delimter like commas,
colons etc.. Is there another way to do this?

Thanks for your help.

V


Jul 21 '05 #3
Hi varad
Try this cod
-------------------------------------------------------------------------------------
Dim svlTemp As String = "<br><a href='www.link1.com'>Link1</a><!----><br><a
href='www.link2.com'>Link2</a><!----><br><a
href='www.link3.com'>Link3</a><!---->"
Dim svlArray() As String
Dim objSplit As System.Text.RegularExpressions.Regex
svlArray = objSplit.Split(svlTemp, "<!---->",
RegexOptions.Singleline Or RegexOptions.IgnoreCase Or RegexOptions.Multiline)

For Each ArrValue As String In svlArray
MsgBox(ArrValue)
Nex
-------------------------------------------------------------------------------------
This examble uses simple regular expressions.
for detaild info plese refer the following locations.

http://msdn.microsoft.com/library/de...xpressions.asp

http://www.regular-expressions.info/dotnet.html

String.split function is to split the strings by a single charactor.

consider
svlTemp = "hai,bie:see(yiu"
u want to split it to hai & bye & see & you
u can use
svlTemp.split(",:(".toCharArray()) it splits the the svlTemp into above
requirement

Regards
Prakash

Jul 21 '05 #4
THanks a lot Prakash. It worked! I greatly appreciate your help.

V

"prakash" wrote:
Hi varad
Try this code
-------------------------------------------------------------------------------------
Dim svlTemp As String = "<br><a href='www.link1.com'>Link1</a><!----><br><a
href='www.link2.com'>Link2</a><!----><br><a
href='www.link3.com'>Link3</a><!---->"
Dim svlArray() As String
Dim objSplit As System.Text.RegularExpressions.Regex
svlArray = objSplit.Split(svlTemp, "<!---->",
RegexOptions.Singleline Or RegexOptions.IgnoreCase Or RegexOptions.Multiline)

For Each ArrValue As String In svlArray
MsgBox(ArrValue)
Next
-------------------------------------------------------------------------------------
This examble uses simple regular expressions.
for detaild info plese refer the following locations.

http://msdn.microsoft.com/library/de...xpressions.asp

http://www.regular-expressions.info/dotnet.html

String.split function is to split the strings by a single charactor.

consider
svlTemp = "hai,bie:see(yiu"
u want to split it to hai & bye & see & you
u can use
svlTemp.split(",:(".toCharArray()) it splits the the svlTemp into above
requirement

Regards
Prakash

Jul 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Henry Chen | last post: by
4 posts views Thread by Simon Schaap | last post: by
3 posts views Thread by Seong-Kook Shin | last post: by
6 posts views Thread by Senthil | last post: by
3 posts views Thread by Hetal Shah | last post: by
4 posts views Thread by Crirus | last post: by
4 posts views Thread by Varad | last post: by
4 posts views Thread by thiago_bagua | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.