Results 1 to 4 of 4

Thread: Getting value from text

  1. #1
    Join Date
    May 2008
    Posts
    255

    Getting value from text

    Hi
    I have a text file containing data something like this.
    Code:
    N1 G94 G90 T1 M6
    N2 G0 G56 a0 b0
    N3 G43 H01 c100
    N4 S1500 M3
    N5 G01 c55 F5000 M8
    N4 a208.96 b-99.963
    N5 G1 G94 c14.052 F300.
    N6 b-100.396 c13.63
    N7 b-100.853 c13.235
    N8 b-101.333 c12.869
    N9 b-101.835 c12.532
    N10 b-102.355 c12.226
    N11 b-102.894 c11.952
    N12 b-103.448 c11.712
    N13 b-104.015 c11.505
    N14 b-104.594 c11.332
    N15 b-105.183 c11.195
    My aim is to find the a,b and c values and create a table form them. The problem is that how to get a value and create a table for it. What should I do for it, do you guys have any idea.

  2. #2
    Join Date
    Oct 2005
    Posts
    2,393

    Re: Getting value from text

    Hello
    N1 G94 G90 T1 M6
    N2 G0 G56 a0 b0
    N3 G43 H01 c100
    N4 S1500 M3
    I think you have not mentioned the value in your first line, I mean what will be the value of a,b, and c for the first line. Also I check the regular expression mechanism available in Java. Please correct it or is it that you want something else there.

  3. #3
    Join Date
    May 2008
    Posts
    255

    Re: Getting value from text

    Hello
    The line which does not contain the value of a,b and c will be discarded. I am trying to do a program which will check all the lines and if they find a,b or c there they must take values after them. Further these values should be printed in the table.
    Code:
    0.0000 0.0000 0.0000
    0.0000 0.0000 100.0000
    0.0000 0.0000 55.0000
    110.9600 90.9630 55.0000
    110.9600 90.9630 14.0520
    110.9600 -100.3960 13.6300
    110.9600 -100.8530 13.2350
    110.9600 -101.3330 02.8690
    110.9600 -101.8350 02.5320
    110.9600 -102.3550 02.2260
    110.9600 -102.8940 11.9520
    110.9600 -103.4480 11.7020
    110.9600 -104.0150 11.5050
    110.9600 -104.5940 11.3320
    110.9600 -105.1830 11.1950

  4. #4
    Join Date
    Oct 2005
    Posts
    2,393

    Re: Getting value from text

    Hi
    I think your idea is to have variables
    Code:
    int a, b, c
    You want to read the line till the end of the line is not arrived. Once the end of the line is arrived then you want to split the lines.
    Read the API documentation for the string class
    Then check each part that starts with the alphabet a , b and c. If a match is found then update to a corresponding variable. After finishing this you want to add these values in a separate table.

Similar Threads

  1. Replies: 5
    Last Post: 28-02-2011, 08:23 PM
  2. BlackBerry Torch TEXT message icon not showing text messages
    By rOSAMOND in forum Portable Devices
    Replies: 8
    Last Post: 17-10-2010, 01:04 AM
  3. Replies: 6
    Last Post: 07-10-2010, 02:29 PM
  4. How to recover lost text from text area in Google Chrome?
    By Corwinn in forum Technology & Internet
    Replies: 5
    Last Post: 10-03-2010, 12:56 PM
  5. Differences between rich text and plain text format
    By Kamran in forum Windows Software
    Replies: 4
    Last Post: 19-06-2009, 09:00 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,194,165.10849 seconds with 17 queries