Results 1 to 3 of 3
  1. #1
    bistiman is offline Member
    Join Date
    Feb 2010
    Posts
    2
    Rep Power
    0

    Default Reading a text file with a distinctive pattern

    Hi guys,

    I have this text file I have to read which looks like the following:

    [10000000,35000000,25000000]

    [[0,0,0,1,0,0],[0,0,0,0,1,0],[0,0,0,0,0,1]]

    The only thing I now before extracting this information is whether the single, double array but don't know the length of the array I was wondering what method to use to extract this information. I've looked at possibly regex or using the tokens but having. Just needed something to start with.

    Thanks,
    Stephan

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Quote Originally Posted by bistiman View Post
    The only thing I now before extracting this information is whether the single, double array but don't know the length of the array I was wondering what method to use to extract this information. I've looked at possibly regex or using the tokens but having. Just needed something to start with.
    Do you mean that you know in advance if the text holds a series of one-dimensional vs two-dimensional arrays? If one type of array, are all lines the same type? In other words, if a line holds two-dimensional array information, do all lines hold a single two-dimensional array? How will you know what type of array is present? Also, are all numbers ints?

    The more information you can give us, the greater the detail on the data's regularity, the easier it will be for someone to solve.

  3. #3
    bistiman is offline Member
    Join Date
    Feb 2010
    Posts
    2
    Rep Power
    0

    Default

    Do you mean that you know in advance if the text holds a series of one-dimensional vs two-dimensional arrays?

    Yes

    If one type of array, are all lines the same type? In other words, if a line holds two-dimensional array information, do all lines hold a single two-dimensional array?

    Yes, well they could also be on separate lines like
    [[0,0,0,1,0,0],
    [0,0,0,0,1,0],
    [0,0,0,0,0,1]]

    How will you know what type of array is present? Also, are all numbers ints?

    All the arrays contain ints

Similar Threads

  1. Reading in a text file
    By TheRealHoff in forum AWT / Swing
    Replies: 10
    Last Post: 02-07-2010, 11:47 PM
  2. reading text file
    By trofyscarz in forum New To Java
    Replies: 1
    Last Post: 02-05-2010, 02:24 AM
  3. Reading a text file
    By diegosened in forum New To Java
    Replies: 4
    Last Post: 01-15-2010, 11:32 PM
  4. Reading two text file and sum them up
    By matt_well in forum New To Java
    Replies: 36
    Last Post: 07-22-2008, 02:55 AM
  5. Reading text file
    By Lennon-Guru in forum New To Java
    Replies: 1
    Last Post: 12-15-2007, 11:38 PM

Posting Permissions

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