Results 1 to 3 of 3

Thread: Best Interface for Large Array (Not Quite Urgent, but still important)

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2002
    Posts
    56

    Best Interface for Large Array (Not Quite Urgent, but still important)

    Ok, I need to do the following:

    Read an array into a textbox/label (Figured out a long time ago)
    Format the contents of a textbox into an array

    Sounds simple. Use split() to put it right back into the array

    Now my problems begin to arise:

    The array is 2d, not 1d
    And it has to be formatted a certain way

    1 -1 1 -1
    -1 1 -1 1
    1 -1 1 -1
    -1 1 -1 1

    (I know it looks wierd, but it will be displayed with a monospace font in the program. The ultimate goal is for the ones to line up.)

    A 1 or 0 has 1 space before, and one space after. A -1 has 1 space after. When using split() this results in blank entries.

    Anyway, some code or some tips on how to code something that can format the raw text into an array. Email me: [email protected]

    Btw: The array will have variable size, and the only numbers that it has to worry about are -1, 0 and 1.





    Thank you for spending your time helping me with this.

  2. #2
    The picture isn't missing BuggyProgrammer's Avatar
    Join Date
    Oct 2000
    Location
    Vancouver, Canada
    Posts
    5,217
    well... you could first split by double-spaces, then loop through that array and split by single spaces, then you will have each item there, and no blank items.
    Remember, if someone's post was not helpful, you can always rate their post negatively .

  3. #3

    Thread Starter
    Member
    Join Date
    Mar 2002
    Posts
    56
    But what about the multiple lines. Would this psuedo-code work?
    Replace " " with " " '2 spaces with 1
    Split the text using vbcrlf as the delimiter.
    For each element in the resulting array (i)
    Split the element i with " " as the delimiter
    For each element in the resulting array (j)
    Add it the master array at point i,j
    next
    next

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