473,503 Members | 3,884 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3212
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2545
by: Henry Chen | last post by:
Hi, I have a string that needs to be parsed into the string. The separator is not char. It is something like " at ". With current string.Split function, it doesn't work. Is there any exist...
4
8775
by: Simon Schaap | last post by:
Hello, I have encountered a strange problem and I hope you can help me to understand it. What I want to do is to pass an array of chars to a function that will split it up (on every location where...
3
14631
by: Seong-Kook Shin | last post by:
C FAQ Q 13.2 says that sprintf() is guaranteed to work only for n <= 509: sprintf(dest, "%.*s", n, source); Does 509 appear in any C standard? If not, where it came from? I looked over C99...
6
6357
by: Senthil | last post by:
Code ---------------------- string Line = "\"A\",\"B\",\"C\",\"D\""; string Line2 = Line.Replace("\",\"","\"\",\"\""); string CSVColumns = Line2.Split("\",\"".ToCharArray());
19
10892
by: David Logan | last post by:
We need an additional function in the String class. We need the ability to suppress empty fields, so that we can more effectively parse. Right now, multiple whitespace characters create multiple...
3
19300
by: Hetal Shah | last post by:
It is a C# code. I have a string like, one||two||three I want to split it into one, two and three. string str = "one||two||three"; string myStrs = str.Split("||");
4
6858
by: Crirus | last post by:
There is a function somewhere to split a string with multiple tokens at a time? Say I have this: aaaa#bbbbb*ccccc$dddd I whould like to split it so the result whould be aaaa bbb
4
188
by: Varad | last post by:
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><!----> ...
4
4014
by: thiago_bagua | last post by:
Hi all, I have a csv file exported from excel. On cells where there was a comma in the text, it wraps the character with double quotes. For example: Column 1,"column two, and some more...
0
7188
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
1
6970
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7441
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5558
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4987
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4663
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3156
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3146
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
366
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.