473,394 Members | 1,718 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 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 3210
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
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
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
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
by: Senthil | last post by:
Code ---------------------- string Line = "\"A\",\"B\",\"C\",\"D\""; string Line2 = Line.Replace("\",\"","\"\",\"\""); string CSVColumns = Line2.Split("\",\"".ToCharArray());
19
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
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
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
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
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...

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.