473,405 Members | 2,160 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,405 software developers and data experts.

Split function question

Hi

I have written a Split function which in turn calls the standard string
split function. Code is below;

Function Split1(ByVal Expression As String, Optional ByVal Delimiter As
String = " ", Optional ByVal Limit As Integer = -1, Optional ByVal Compare
As CompareMethod = CompareMethod.Binary, Optional ByVal MaxLength As Integer
= 0) As String()

InAr = Expression.Split(Delimiter, Limit, Compare)

End Function

My questions are ;

1. Passing the Limit parameter causes a runtime error as the default for
Limit (-1) is not acceptable. What is the problem? I have a feeling the
syntax of split function in MSDN
(http://msdn.microsoft.com/en-gb/library/6x627e5f.aspx) may be out dated.

2. How can I overloaded my split function with standard split function so I
can use is as St.Split(...)?

Thanks

Regards

Jun 27 '08 #1
1 2404
The documentation that you referenced is for the
Microsoft.VisualBasic.Split() function. You appear to be using the
String.Split() function, which is documented at
http://msdn.microsoft.com/en-us/library/c1bs0eda.aspx. That page states you
cannot pass a -1.
"John" wrote:
Hi

I have written a Split function which in turn calls the standard string
split function. Code is below;

Function Split1(ByVal Expression As String, Optional ByVal Delimiter As
String = " ", Optional ByVal Limit As Integer = -1, Optional ByVal Compare
As CompareMethod = CompareMethod.Binary, Optional ByVal MaxLength As Integer
= 0) As String()

InAr = Expression.Split(Delimiter, Limit, Compare)

End Function

My questions are ;

1. Passing the Limit parameter causes a runtime error as the default for
Limit (-1) is not acceptable. What is the problem? I have a feeling the
syntax of split function in MSDN
(http://msdn.microsoft.com/en-gb/library/6x627e5f.aspx) may be out dated.

2. How can I overloaded my split function with standard split function so I
can use is as St.Split(...)?

Thanks

Regards

Jun 27 '08 #2

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

Similar topics

3
by: alexk | last post by:
I've a simple question. Why the following: words = "123#@$#$@^% wordB#@$".split('~`!@#$%^&*()_+-={},./') doesn't work? The length of the result vector is 1. I'm using ActivePython 2.4 Alex
2
by: SL_McManus | last post by:
Hi All; I am fairly new to Perl. I have a file with close to 3000 lines that I would like to split out in a certain way. I would like to put the record type starting in column 1 for 2 spaces,...
6
by: Senthil | last post by:
Code ---------------------- string Line = "\"A\",\"B\",\"C\",\"D\""; string Line2 = Line.Replace("\",\"","\"\",\"\""); string CSVColumns = Line2.Split("\",\"".ToCharArray());
3
by: John Salerno | last post by:
This is an example in the book I'm reading: string fullName = " Edward C Koop "; fullName = fullName.Trim(); string names = fullName.Split(' '); string firstName = names; //...
5
by: KC | last post by:
Can I do a split() on a string where the delimiter is one or more space characters? I have a string with spaces between the numbers but I don't know how many. You can do this easy in Perl, but...
3
by: Ben | last post by:
Hi I am creating a dynamic function to return a two dimensional array from a delimeted string. The delimited string is like: field1...field2...field3... field1...field2...field3......
7
by: Matthias Winterland | last post by:
Hi, I have a simple question. When I read in a string like: a='1,2,3,4,5 6 7,3,4', can I get the list l= with a single split-call? Thx, Matthias
9
by: dtex23 | last post by:
Good afternoon all, Question about list assignment in perl... Given a piece of code that looks kinda like this for parsing some '|' delimited input text lines : ($var1, $var2, $var3) =...
19
by: fellya | last post by:
Hi, i don't have enough experience in writing codes in Python but now i'm trying to see how i can start using Python. I've tried to write a simple program that can display a sentence. now my...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
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,...

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.