473,320 Members | 1,829 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,320 software developers and data experts.

problem with string function in vb.net

I am using this function :
Dim ArrColWidths() As String

ArrColWidths = Split(string.empty,";")

This always returns an array with 1 element .

Silly in my opinion.

Is there a way around this so that it returns an array with zero elements ?


Jul 2 '06 #1
3 998
giannik, what do you expect than,

What you write is (exactly) the same as

ArrColWidths = Split("",";")

I assume tht this is not your goal?

Cor

"giannik" <gi*****@freemail.grschreef in bericht
news:u8**************@TK2MSFTNGP03.phx.gbl...
>I am using this function :
Dim ArrColWidths() As String

ArrColWidths = Split(string.empty,";")

This always returns an array with 1 element .

Silly in my opinion.

Is there a way around this so that it returns an array with zero elements
?


Jul 2 '06 #2
coming from vb 6 environment, the split function would return an empty
array.
Since I am passing an empty string (nothing ) I would expect also that
the array would contain nothing in it.
giannik

I wish to be able to parse a string with the split function
and then take some action according to if the array is empty or not.
Now if i choose ubound(ArrColWidths) I get back =1 when I would like to get
back zero or nothing.
giannik
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
giannik, what do you expect than,

What you write is (exactly) the same as

ArrColWidths = Split("",";")

I assume tht this is not your goal?

Cor

"giannik" <gi*****@freemail.grschreef in bericht
news:u8**************@TK2MSFTNGP03.phx.gbl...
>>I am using this function :
Dim ArrColWidths() As String

ArrColWidths = Split(string.empty,";")

This always returns an array with 1 element .

Silly in my opinion.

Is there a way around this so that it returns an array with zero elements
?



Jul 2 '06 #3

giannik wrote:
I am using this function :
Dim ArrColWidths() As String

ArrColWidths = Split(string.empty,";")

This always returns an array with 1 element .

Silly in my opinion.
But exactly as documented:
>>
If Expression is a zero-length string (""), Split returns a
single-element array containing a zero-length string. If Delimiter is a
zero-length string, or if it does not appear anywhere in Expression,
Split returns a single-element array containing the entire Expression
string.
>>
In fact the first case here is covered by the second case; it's just
listed explicitly for ... well, explicitness, I suppose.

>
Is there a way around this so that it returns an array with zero elements ?
Wrap it in your own function that does what you want.

What would you want Split("banana", ";") to return, incidentally ?

--
Larry Lard
Replies to group please
When starting a new topic, please mention which version of VB/C# you
are using

Jul 3 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Jeff S | last post by:
In a VB.NET code behind module, I build a string for a link that points to a JavaScript function. The two lines of code below show what is relevant. PopupLink = "javascript:PopUpWindow(" &...
0
by: Lucas, Todd | last post by:
Hello everyone! I'm having a problem with a WebControl that I'm designing for a Menu. I've been at it for about 3 weeks now, and can't seem to get around this problem. So I'm hoping that someone...
8
by: andyjgw | last post by:
Hi all, hope someone can help here, I'm really stuck. Reading and googling like mad, to no avail so far... Basically, my problem *seems* to boil down to type conversion: Here's a sample web...
5
by: ThatVBGuy | last post by:
Hello All, I could really use some help with this problem its driving me nuts. I have a small vb app, the goal of the app is to read an html doc into a variable then go through that variable and...
5
by: jbenner | last post by:
I have opened a PMR for this with IBM, and am not asking for advice from the DB2 DBA community. I am posting this as an FYI that DB2 Health Monitor, even at the latest version of DB2, still can cause...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.