Results 1 to 2 of 2

Thread: Output Issue

  1. #1
    jazz2k8's Avatar
    jazz2k8 is offline Senior Member
    Join Date
    Apr 2008
    Posts
    150
    Rep Power
    7

    Default Output Issue

    Hi Folks,

    Input Text:
    S.No Description Qty Amount in Rs
    1 Tower Building Works (ABC) As per Annexure 282,813.00
    2 Tower Building Works (ABC) As per Annexure 282,812.00
    3 Tower Building Works (ABC) As per Annexure 282,815.00
    String sub1=null;
    String endsub1=null;
    Matcher sub=Pattern.compile("S.No\\s+Description").matcher (data);
    while(sub.find()){
    // System.out.println(sub.group());
    sub1=sub.group();
    //System.out.println(sub1);
    }
    Matcher endsub=Pattern.compile("Invoice\\s+value").matcher (data);


    while(endsub.find()){
    endsub1=endsub.group();
    // System.out.println(endsub1);
    }

    data=data.substring(data.indexOf(sub1),data.indexO f(endsub1));
    // System.out.println(data);
    String remove=null;
    Matcher rmv=Pattern.compile("S.No\\s+Description\\s+Qty\\s +Amount\\s+in\\s+Rs").matcher(data);
    while(rmv.find()){
    remove=rmv.group();
    }
    data=data.replace(remove,"");
    System.out.println("Sub string "+data);
    // data=data.replace(" ","");
    // System.out.println(data);
    table=data.split("\t+");

    for(int i=0;i<table.length;i++){
    System.out.println(" "+(i+1)+" "+table[i]);
    }


    Output:
    1
    Tower Building Works (ABC)
    As per Annexure
    282,813.00 2
    Tower Building Works (ABC)
    As per Annexure
    282,812.00 3
    Tower Building Works (ABC)
    As per Annexure
    282,812.00

    Desired Output:
    S.No: 1
    Description:Tower Building Works (ABC)
    Qty: As per Annexure
    Amount: 282,813.00
    S.No:2
    Description: Tower Building Works (ABC)
    Qty: As per Annexure
    Amount: 282,812.00
    S.No: 3
    Description:Tower Building Works (ABC)
    Qty: As per Annexure
    Amount: 282,815.00
    Is there any thing wrong??

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

Similar Threads

  1. different output
    By pro85 in forum Java Applets
    Replies: 6
    Last Post: 08-05-2008, 01:42 PM
  2. Why the output is always zero
    By mehrotra.chitij in forum New To Java
    Replies: 12
    Last Post: 04-25-2008, 04:05 AM
  3. output
    By Camden in forum New To Java
    Replies: 3
    Last Post: 12-01-2007, 10:34 PM
  4. Issue
    By chaitu444 in forum New To Java
    Replies: 2
    Last Post: 11-06-2007, 07:49 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
  •