Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 14

Thread: Algorithm help

  1. #1
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    This one has me stumpted...I have a string that looks like this:
    Code:
    cat:something
    date:some time
    message:something
    cat:something else
    date:some time else
    message:something else
    cat:something else again
    date:some time else again
    message:something else again
    I want to convert it to an array of strings such that in the example it contains three elements:
    Code:
    cat:something
    date:some time
    message:something
    ,
    Code:
    cat:something else
    date:some time else
    message:something else
    , and
    Code:
    cat:something else again
    date:some time else again
    message:something else again
    .

    I have no clue how to do this. Any pseudocode/VB?
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  2.  

  3. #2
    Senior Member Katie's Avatar
    Join Date
    Mar 2002
    Location
    In the backyard! Come on out and help yourself to
    Posts
    771
    Member #
    31
    Are you talking about a multi-dimensional array?
    Does the moon actually possess strange powers or is it all just lunacy?

    Chris and Pix; the adorable duo!

  4. #3
    Member Electro414's Avatar
    Join Date
    Feb 2002
    Location
    In the middle of, um.... No where!?
    Posts
    71
    Member #
    9
    Originally posted by Katie
    Are you talking about a multi-dimensional array?
    What is a mulitdemensional array? Is it like in VB when you have a vaiable like array (1,2,3)?

    Also, shouldn't this be in the Programming and Web Design Forum?

  5. #4
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    No, it's the equivalent of Split, only splitting the string every fourth newline instead of every newline.

    And yes it should be there but I wanted an answer sooner.
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  6. #5
    Senior Member Katie's Avatar
    Join Date
    Mar 2002
    Location
    In the backyard! Come on out and help yourself to
    Posts
    771
    Member #
    31
    Code:
     
    1     2         3       4    5 6 7 8 9 10 11 12 
    1  20000 21400           
    2  25000 26750           
    3  19000 20330           
    4  22500 24075
    A multi-dimensional array is an array that has more than one dimension!

    myarray(1,2) = 25000
    myarray(2,2) = 26750
    Does the moon actually possess strange powers or is it all just lunacy?

    Chris and Pix; the adorable duo!

  7. #6
    Senior Member Katie's Avatar
    Join Date
    Mar 2002
    Location
    In the backyard! Come on out and help yourself to
    Posts
    771
    Member #
    31
    Did you try the text compare method on the split function....do you know what variable you are looking to split on?
    Does the moon actually possess strange powers or is it all just lunacy?

    Chris and Pix; the adorable duo!

  8. #7
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    I'm just trying to split it at every third line, not every line.
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  9. #8
    Senior Member Katie's Avatar
    Join Date
    Mar 2002
    Location
    In the backyard! Come on out and help yourself to
    Posts
    771
    Member #
    31
    Just use split and then extract every third element in the array.....I still don't think I understand what you're after.
    Does the moon actually possess strange powers or is it all just lunacy?

    Chris and Pix; the adorable duo!

  10. #9
    Member Electro414's Avatar
    Join Date
    Feb 2002
    Location
    In the middle of, um.... No where!?
    Posts
    71
    Member #
    9
    Originally posted by filburt1
    No, it's the equivalent of Split, only splitting the string every fourth newline instead of every newline.

    And yes it should be there but I wanted an answer sooner.
    Cheater!

  11. #10
    Member kedaman's Avatar
    Join Date
    Apr 2002
    Location
    found love in a bubble
    Posts
    55
    Member #
    55
    I suppose you know there's instr and mid for searching for and retrieving substrings, search for newline 2 times and cut out the substring where third starts
    my mixes DC++ goto parksie's hub: parksie.d2g.biz:1411 search for "seduction" or "dj keda"
    thanks - and would be nice if you could host and share them if you like them


Page 1 of 2 1 2 LastLast

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 08:55 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com