Results 1 to 4 of 4

Thread: parsing a string?

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2001
    Posts
    9

    parsing a string?

    Well I have a string (the lenght is not known)that contains commas (,). How can I parse this string and keep in variables the substrings between the commas?Meaning for example
    123,1232,455,564,5466,456645,564565
    andmake it
    x=123
    y=1232
    z=455
    f=564 and so long.....
    I would appreciate every possible help.
    thanks on advance

  2. #2
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    Code:
    dim myarray
    
    myarray=split("111,222,333",",")
    
    'now you have all three values in an array
    'myarray(0) = "111"
    'myarray(1) = "222"
    'myarray(2) = "333"
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  3. #3

    Thread Starter
    New Member
    Join Date
    Apr 2001
    Posts
    9
    thanks and I have one more question
    well I create an array of i positions where i=lenght of the string.
    now how can I dynamically fill this positions with the values that come out of "split"?

  4. #4
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    Um.. didn't he already answer that? Split auto fills the array.
    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    [email protected]
    [email protected]


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

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