473,549 Members | 3,065 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 3222
Use a regular expression.

"Varad" <va******@gmail .com> wrote in message
news:EC******** *************** ***********@mic rosoft.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******** *************** ***********@mic rosoft.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.Reg ularExpressions .Regex
svlArray = objSplit.Split( svlTemp, "<!---->",
RegexOptions.Si ngleline Or RegexOptions.Ig noreCase Or RegexOptions.Mu ltiline)

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(yi u"
u want to split it to hai & bye & see & you
u can use
svlTemp.split(" ,:(".toCharArra y()) 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.Reg ularExpressions .Regex
svlArray = objSplit.Split( svlTemp, "<!---->",
RegexOptions.Si ngleline Or RegexOptions.Ig noreCase Or RegexOptions.Mu ltiline)

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(yi u"
u want to split it to hai & bye & see & you
u can use
svlTemp.split(" ,:(".toCharArra y()) 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
2563
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 functions like "Split" that I can use to do the job? Any idea of the simpliest way to do the job? Thanks in advance, Henry
4
8787
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 a * occurs in the string). This split function should allocate a 2D array of chars and put the split results in different rows. The listing below...
3
14642
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 (ISO/IEC 9899:1999) but didn't find yet. If that limitation is old standard (perhaps ANSI?), does it limit the total length of the string that...
6
6361
by: Senthil | last post by:
Code ---------------------- string Line = "\"A\",\"B\",\"C\",\"D\""; string Line2 = Line.Replace("\",\"","\"\",\"\""); string CSVColumns = Line2.Split("\",\"".ToCharArray());
19
10898
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 empty strings in the resulting string array.
3
19305
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
6863
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><!----> If I use string.split command, it splits based on the first "<" in "<!---->" and not the whole <!---->. It works fine with single delimter like...
4
4017
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 stuff",Column 3 In a c# dll, .NET framework 1.1, I'm reading the file using a streamreader then retrieving each line into a string using...
0
7518
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main...
0
7715
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7956
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7469
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7808
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5087
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3498
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1935
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1057
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.