Results 1 to 3 of 3

Thread: tokenize strings

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2004
    Posts
    11

    tokenize strings

    How do you tokenize strings in VB. I'm used to doing it in Java.

    Sample of my string to tokenize....

    "53233, 38948, 43223, 23449"

    I need pull these numbers out individually.

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083

    Re: tokenize strings

    Originally posted by pokermagic
    How do you tokenize strings in VB. I'm used to doing it in Java.

    Sample of my string to tokenize....

    "53233, 38948, 43223, 23449"

    I need pull these numbers out individually.
    A basic code :

    VB Code:
    1. Dim str As String = "53233,38948,43223,23449"
    2.         For Each c As Char In str.ToCharArray
    3.             MessageBox.Show(c.ToString)
    4.         Next

  3. #3
    Lively Member ayan's Avatar
    Join Date
    Jan 2004
    Posts
    112
    VB Code:
    1. Module Module1
    2.  
    3.     Sub Main()
    4.       Dim s As String = "1234, 5678, 9101"
    5.       Dim ss As String() = Split(s, ", ")
    6.       Dim sss As String
    7.       For Each sss In ss
    8.          Console.WriteLine(sss)
    9.       Next
    10.     End Sub
    11.  
    12. End Module
    like this? if not, sorry...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width