RE: issue with split function in vb.net

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hi,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you are unable to split some of your
string lines. If there is any misunderstanding, please feel free to let me
know.

I think the part "line.Split.GetUpperBound(0)" is not necessary in the
code, because the Split method will split according to all delimiters
without specifying the count. So I changed the code to the following. It
works fine on my machine.

Dim strDelim As String = "*~"
Dim delimiter As Char() = strDelim.ToCharArray
Dim split As String() = Nothing
Dim fieldCount As Integer
Dim s As String

split = line.Split(delimiter)
fieldCount = 0
For Each s In split
Dim y As String = s
If y <> "" Then
fieldCount = fieldCount + 1
End If
Next s
Dim strAddress As Object = split.GetValue(fieldCount - 1)

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

.



Relevant Pages

  • Re: Install Windows Patch via GPO
    ... This posting is provided "AS IS" with no warranties, and confers no rights. ...
    (microsoft.public.windows.group_policy)
  • Re: Trust windows 2k to windows 2k3
    ... This posting is provided "AS-IS" with no warranties or guarantees and ... confers no rights. ... only reply to Newsgroups ...
    (microsoft.public.windows.server.active_directory)
  • Re: Trust windows 2k to windows 2k3
    ... This posting is provided "AS-IS" with no warranties or guarantees and confers no rights. ... only reply to Newsgroups ...
    (microsoft.public.windows.server.active_directory)
  • Re: Installing a 360 Media Center Extender
    ... This posting is provided "AS IS" with no warranties, and confers no rights. ...
    (microsoft.public.windows.mediacenter)
  • Re: Trust windows 2k to windows 2k3
    ... This posting is provided "AS IS" with no warranties, and confers no rights. ... only reply to Newsgroups ...
    (microsoft.public.windows.server.active_directory)