469,926 Members | 1,492 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,926 developers. It's quick & easy.

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 2180
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by alexk | last post: by
2 posts views Thread by SL_McManus | last post: by
6 posts views Thread by Senthil | last post: by
3 posts views Thread by John Salerno | last post: by
5 posts views Thread by KC | last post: by
7 posts views Thread by Matthias Winterland | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.