Hi Friends how to extract following data and store in string variable. All variable are string no need to use any other data type like datetime and so on.

Deposits and Additions
  Date      Description                                   Amount        Refe
  11/01     Test1 201f13050000100 NEWEDGE          1,500,000.00
            OBI:FFC SAN LAZARO, SA A/C 430
  11/01     Test2 20f113050021500 VIGO RE                149.00
            OBI:VIGO SETTLEMENT GTV14
  11/01     Deposit                                   350,777.06
  11/01     Opening Checking Deposit                   38,097.29
  11/02     Test3 20113060003600 GEORGE             350,000.00
            OBI:/RFB/TO ( MULTITRADING LIM
  11/02     Test4 20113060014100 1/SHARE            159,964.20
            OBI:/RFB/PAYMENT OF GOODS
  11/03     Test5 20113070029800 TJ HARK             52,660.00
            OBI:
  11/04     Test5 20113080002900 SHAREKA             80,000.00
            OBI:/RFB/TO (MULTITRADING LIMI
  11/04     Test6 20113080034100 ULTRA T             79,200.00
            OBI:PO : S/7960 INV : 6555 S/8
  11/04     Test7 20113080002800 GEORGE              60,000.00
            OBI:/RFB/TO ( MULTITRADING LIM
  11/04     Test8 20113080033400 BANCO I             22,826.00
            OBI:

After extract i get out like

Date : 11/01 
Description : Test1 20113050000100 NEWEDGE OBI:FFC SAN LAZARO, SA A/C 430
Amount : 1,500,000.00
Refe :

Date : 11/01 
Description : Test2 20113050021500 VIGO RE OBI:VIGO SETTLEMENT GTV14
Amount : 149.00
Refe :

Date : 11/01 
Description :Deposit
Amount : 350,777.06
Refe :

Date : 11/01 
Description :Opening Checking Deposit
Amount : 38,097.29
Refe :

Date : 11/01 
Description :Test3 20113060003600 GEORGE OBI:/RFB/TO ( MULTITRADING LIM
Amount : 350,000.00
Refe :

This is really urgent. Hoping sooner response from my friend z

Thanks in advance.

Recommended Answers

All 3 Replies

The input data seems to be wrapped. Is that correct?
So there are really only 11 lines of data and two header lines?

If the data is in a file, you can use the Scanner class to read the contents of the file into Strings using one of its next....() methods.

Using the Scanner class would be the best. You can read each section of the file with it and specify the delimiter to use.

Something like this:

Scanner fileReader = new Scanner("FILENAME.txt");
while(fileReader.hasNext()) {
	String item = fileReader.next(" ");
	// Print or store the string, read in the next line
	System.out.println("First thing: " + item);
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.