I cannot get this code to line up underneath the headers - java

I have to get my output to line up beneath a heading. No matter what I do, I cannot get to line up. The item name is very long also, and the words end up wrapping to the next line when I open my outfile. Here is my current output:
8 items are currently available for purchase in Joan's Hardware Store.
----------Joan's Hardware Store-----------
itemID itemName pOrdered pInStore pSold manufPrice sellPrice
1111 Dish Washer 20 20 0 250.50 550.50
2222 Micro Wave 75 75 0 150.00 400.00
3333 Cooking Range 50 50 0 450.00 850.00
4444 Circular Saw 150 150 0 45.00 125.00
5555 Cordless Screwdriver Kit 10 10 0 250.00 299.00
6666 Keurig Programmable Single-Serve 2 2 0 150.00 179.00
7777 Moen Chrome Kitchen Faucet 1 1 0 90.00 104.00
8888 Electric Pressure Washer 0 0 0 150.00 189.00
Total number of items in store: 308
Total inventory: $: 48400.0
Here is my code:
public void endOfDay(PrintWriter outFile)
{
outFile.println (nItems + " items are currently available for purchase in Joan's Hardware Store.");
outFile.println("----------Joan's Hardware Store-----------");
outFile.printf("itemID, itemName, pOrdered, pInStore, pSold, manufPrice, sellPrice");
for (int index = 0; index < nItems; index++)
{
outFile.printf("%n %-5s %-32s %d %d %d %.2f %.2f%n", items[index].itemID , items[index].itemName , items[index].numPord ,items[index].numCurrInSt , items[index].numPSold , items[index].manuprice , items[index].sellingprice);
}
outFile.println("Total number of items in store: " + getTotalOfStock());
outFile.println("Total inventory: $: " + getTotalDollarValueInStore());
} // end endOfDay
Thanks for any help! I have tried many things for hours!!

Basically, you need to format your header the same way you format your lines, for example...
System.out.println("----------Joan's Hardware Store-----------");
System.out.printf("%-6s %-32s %-8s %-8s %-5s %-10s %-8s%n", "itemID", "itemName", "pOrdered", "pInStore", "pSold", "manufPrice", "sellPrice");
System.out.printf("%-6s %-32s %-8d %-8d %-5d %-10.2f %-8.2f%n", "1111", "Dish Washer", 20, 20, 0, 250.50, 550.50);
Results in...
----------Joan's Hardware Store-----------
itemID itemName pOrdered pInStore pSold manufPrice sellPrice
1111 Dish Washer 20 20 0 250.50 550.50

Related

Read csv file with Java OpenCSV

I have the following .csv file:
Company ABC
"Jan 1, 2020 - Sep 30, 2020"
Product Country Avg. monthly clients Avg. month charge Parts change Impact In stock Clients in list City
Nissan Maxima USA 6600 0% -18% Low 18
BMW X7 M50i USA 18100 22% 0% Low 28
Volvo XC90 USA 880 0% -12% Low 10
Opel Insignia USA 320 -34% -34% Low 23
Renult Triber USA 140 -18% -36% Low 8
Toyota Yaris USA 880 0% -28% Low 30
Ford Mondeo USA 70 -20% -71% Low 1
for delimiter I have empty space(Tab). I tried to use this code in order to read the file using Opencsv:
#Getter
#Setter
public class CsvLine {
#CsvBindByPosition(position = 1)
private String model;
#CsvBindByPosition(position = 2)
private String country;
}
String fileName = "C:\\in_progress\\zzz.csv";
List<CsvLine> beans = new CsvToBeanBuilder(new FileReader(fileName))
.withType(CsvLine.class)
.withSeparator(' ')
.withSkipLines(1)
.build()
.parse();
for(CsvLine item: beans){
System.out.println(item.getModel());
}
But I get this output:
X C 9 0
null
I n s i g n i a U S A 3 2 0 - 3 4 % - 3 4 % L o w 2 3
null
T r i b e r
null
Y a r i s U S A 8 8 0 0 % - 2 8 % L o w 3 0
null
M o n d e o U S A 7 0 - 2 0 % - 7 1 % L o w 1
null
null
Do you know how I can the file properly with Java preferably with OpenCSV?
Test file https://www.dropbox.com/s/7jo4i3bs6h8at25/zzz.csv?dl=0
If your CSV file really uses the Tab character as field delimitier, it should be sufficient to change to:
List<CsvLine> beans = new CsvToBeanBuilder(new FileReader(fileName))
.withType(CsvLine.class)
.withSeparator('\t')
.withSkipLines(2)
.build()
.parse();
I changed withSeparator argument and increased the number of lines to skip to 2

Display the total amount of each products below the table

I'm using itextpdf to display the sql query
SELECT prod_id, prod_name, amt, sum(amt) over(partition by prod_name) as total_amt
FROM items
ORDER BY prod_name;
I was able separate the table according to PROD_NAME, and calculate the total amount of each products by getting the sum(amt) over(partition by prod_name) as total_amt from the sql query. Now, I've been trying to display the total amount of each products below like this:
APPLE
PROD_ID | AMT
11111 12.75
22222 13.75
33333 14.75
Total: 41.25
ORANGE
PROD_ID | AMT
44444 15.75
55555 16.75
Total: 32.5
However, this is the output of my code. The Total amount is displayed after each row.
APPLE
PROD_ID | AMT
11111 12.75
Total: 41.25
22222 13.75
Total: 41.25
33333 14.75
Total: 41.25
ORANGE
PROD_ID | AMT
44444 15.75
Total: 32.5
55555 16.75
Total: 32.5
Here is the snippet of my code:
List<String> prod_Names = new ArrayList<>();
while(rs.next()){
String prodName = rs.getString(2);
if (!prod_Names.contains(prodName)){
prod_Names.add(prodName);
// Displays the Product Name on top of the table
PdfPCell name = new PdfPCell(new Phrase(prodname, bold));
name.setColspan(2);
prod_Table.addCell(name);
// Displays the Row Header
prod_Table.addCell(new Phrase("PROD_ID", header_Bold));
prod_Table.addCell(new Phrase("AMT", header_Bold));
}
String prodId_Values = result.getInt(1);
int amt_Values = result.getInt(3); // amount
int totalAmt = result.getInt(4); // total amount of each products
//Displays the Values
prod_Table.addCell(new Phrase(Integer.toString(prodId_Values), normalFont));
prod_Table.addCell(new Phrase(Integer.toString(amt_Values), normalFont));
// Display Total
prod_Table.addCell(new Phrase("TOTAL:", normalFont));
prod_Table.addCell(new Phrase(Integer.toString(totalAmt), normalFont));
}
I tried putting the Display Total lines inside an if condition just like how I did with the Product Name. I also added another ArrayList called prod_Names2.
if(!prod_Names2.contains(prodName)){
prod_Names2.add(prodName);
// Display Total
prod_Table.addCell(new Phrase("TOTAL:", normalFont));
prod_Table.addCell(new Phrase(Integer.toString(totalAmt), normalFont));
}
The total amount is now only displayed one time, but it's displayed after one row of each products like this. This is the best that I could do:
APPLE
PROD_ID | AMT
11111 12.75
Total: 41.25
22222 13.75
33333 14.75
ORANGE
PROD_ID | AMT
44444 15.75
Total: 32.5
55555 16.75
In Standard SQL you can do what you want using grouping sets:
SELECT prod_id, prod_name, SUM(amt) as amt
FROM items
GROUP BY GROUPING SETS ( (prod_id, prod_name), () )
ORDER BY prod_name NULLS LAST;
Not all databases support exactly this syntax, but most support some variation of it. Then your java code can just read the results from the query.

How to read a tab separated file and select few values from it using java

I have a tab separated file which looks like this
STID STNM TIME TMAX TMAXO TMIN TMINO TAVG TBAD DMAX DMAXO DMIN DMINO DAVG VDEF DBAD SMAX SMAXO SMIN SMINO SAVG SBAD BMAX BMAXO BMIN BMINO BAVG BBAD S5MX S5MXO S5MN S5MNO S5AV S5BD S25X S25XO S25N S25NO S25AV S25BD S60X S60XO S60N S60NO S60AV S60BD HMAX HMAXO HMIN HMINO HAVG HBAD PMAX PMAXO PMIN PMINO PAVG MSLP PBAD AMAX AMAXO ATOT ABAD PDIR PDFQ SDIR SDFQ IBAD WSMX WSMXO WSMN WSMNO WSPD WDEV WMAX WMAXO WBAD RAIN RNUM RMAX RBAD 9AVG 9BAD 2MAX 2MIN 2AVG 2DEV 2BAD HDEG CDEG HTMX HTMXO HTBAD WCMN WCMNO WCBAD
ACME 110 0 76.32 131 69.22 184 71.57 0 69.10 286 61.55 3 66.48 4.22 0 83.16 3 78.24 288 80.85 0 85.37 3 77.74 288 81.77 0 83.12 150 77.86 288 80.58 0 83.84 3 81.23 288 82.34 0 81.54 3 80.94 285 81.29 0 96.82 278 66.82 1 84.59 0 28.74 284 28.67 23 28.71 30.10 0 412.73 130 5.46 0 -996 -999 -996 -999 59 10.92 132 0.00 37 4.34 2.41 14.61 146 0 0.22 19 0.24 0 71.67 0 8.44 0.00 2.49 2.30 0 0.00 7.77 -996 999 288 -996 999 288
ADAX 1 0 73.99 96 68.61 21 71.32 0 70.91 169 62.77 1 68.22 2.58 0 87.15 3 82.99 288 84.83 0 88.32 3 79.54 288 83.59 0 85.06 3 81.84 288 83.31 0 88.48 3 85.21 288 86.61 0 -996 999 -996 999 -996 96 98.40 274 73.27 1 90.20 0 29.08 137 29.01 17 29.04 30.08 0 210.42 151 5.23 0 -996 -999 -996 -999 139 12.83 106 0.00 33 3.65 3.03 19.28 121 0 0.24 23 0.24 0 71.57 0 8.84 0.00 2.07 2.48 0 0.00 6.30 -996 999 288 -996 999 288
ALTU 2 0 75.51 107 68.74 168 71.63 0 70.43 279 64.56 125 67.48 3.50 0 80.60 3 77.88 288 78.91 0 79.11 3 75.96 288 77.08 0 79.97 3 77.23 288 78.41 0 81.95 3 79.57 288 80.55 0 -996 999 -996 999 -996 96 98.36 286 70.28 106 87.18 0 28.68 276 28.60 51 28.64 30.09 0 202.20 123 5.03 0 2 30.80 4 18.63 25 13.72 128 0.00 70 5.79 2.71 18.19 128 0 0.19 19 0.12 0 71.53 0 9.55 0.00 3.71 2.22 0 0.00 7.12 -996 999 288 -996 999 288
I am trying to read this file so that I can append some of the values from this file to another file.
But firstly I am unable to read the values of the column TMAX which is 4th in the columns
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
public class first {
public static void main(String[] args)
{
// TODO Auto-generated method stub
String fileName="daily.txt";
File file = new File(fileName);
try{
Scanner inputStream = new Scanner(file);
while (inputStream.hasNext()){
String data = inputStream.next();
String[] values = data.split("\t");
System.out.println(values[4]);
}
inputStream.close();
}
catch(FileNotFoundException e){
e.printStackTrace();
}
}
}
When I use the above code the output looks like this
STID
STNM
TIME
TMAX
TMAXO
TMIN
TMINO
TAVG
TBAD
DMAX
DMAXO
DMIN
DMINO
DAVG
VDEF
DBAD
SMAX
SMAXO
SMIN
I want to get an output which displays the values of the specified column numbers.
You need to use nextLine instead of next to read the whole line. Also I ran your program and found out that your file is not truely splitted by tab that's why your split may not work. Fix these two things and then you are good to go.
Here's a sample method which achieves what you're looking for (not tested, but the concept is there). Essentially, you need to read by line, split the line into some sort of array or list, and then have 2d array. you can also replace split("\t") with splitting by white space in general.
public List<String> getByColumn(int col, File file)
{
List<ArrayList<String>> arrayOfArrays = null;
try {
FileInputStream fis = new FileInputStream(file);
InputStreamReader isr = new InputStreamReader(fis, "UTF-8");
BufferedReader br = new BufferedReader(isr);
String line;
arrayOfArrays = new ArrayList<ArrayList<String>>();
while ( ( line = br.readLine() ) != null )
{
ArrayList<String> list = new ArrayList<String>(Arrays.asList(line.split("\t")));
arrayOfArrays.add(list);
}
} catch (IOException e) {
e.printStackTrace();
}
ArrayList<String> output = new ArrayList<String>();
//can use a foreach loop, or the below method.
//for (ArrayList<String> l : arrayOfArrays)
//{
// output.add(l.get(col));
//}
for ( int i = 1; i < arrayOfArrays.size(); i++ )
{
output.add(arrayOfArrays.get(i).get(col));
}
return output;
}
You should really use univocity-parsers for that - it will be way faster than your String.split and also helps a lot selecting the columns you want:
//configure the parser
TsvParserSettings parserSettings = new TsvParserSettings();
parserSettings.selectFields("TMAX" /*and others*/);
//then parse
TsvParser parser = new TsvParser(parserSettings);
List<String[]> parsedRows = parser.parseAll(new File("daily.txt"), "UTF-8");
Hope this helps.
Disclaimer: I'm the author of this library. It's open source and free (Apache 2.0 license)
use this code to parse the line
String[] values = data.trim().replaceAll(" +", " ").split(" ");

Print integer barcode with zebra in CPCL language

I have an java app and I'm trying to print code. Everything works fine until my data is an integer,only digits. The printing is made in another function like this :
byte[] configLabel = getConfigLabel();
printerConnection.write(configLabel);
private byte[] getConfigLabel() {
byte[] configLabel = null;
String str=inputbarcode.getText().toString();
String str2 = "link";
StringBuilder print = new StringBuilder("! UTILITIES\r\n");
print.append("IN-MILLIMETERS\r\n");
print.append("SETFF 15 2.5\r\n");
print.append("PRINT\r\n");
print.append("! 0 180 180 180 1\r\n");
print.append("CENTER\r\n");
print.append("BARCODE 128 1 1 50 0 20"+str.toString()+"\r\n");
print.append("T 0 3 0 80"+str.toString()+"\r\n");
print.append("T 0 3 0 100"+str2+"\r\n");
print.append("PRINT\r\n");
configLabel=String.valueOf(print).getBytes();
return configLabel;
}
Your code snippet shows missing separator between the barcode and text commands and the actual barcode or text content. Insert one space character at the end of the following strings in your code:
change "BARCODE 128 1 1 50 0 20" to "BARCODE 128 1 1 50 0 20 "
change to "T 0 3 0 80" to "T 0 3 0 80 "
change "T 0 3 0 100" to "T 0 3 0 100 "

Split text file based on string in Java

How can i split text file using string.endwith("Page 1") and store in arraylist?
Can anyone help me to do this ?
Following thing I tried to do this.
while (readerSplit.hasNextLine()) {
String sLineDataSplit = readerSplit.nextLine();
if (!sLineDataSplit.endsWith("Page 1")) {
sbSplitData.append(sLineDataSplit);
sbSplitData.append(newline);
} else {
sbSplitData.append(sLineDataSplit);
sbSplitData.append(newline);
if (sbSplitData.length() > 100) {
System.out.println("Inside");
stringList.add(i, sbSplitData);
System.out.println(sbSplitData);
i++;
sbSplitData.setLength(0);
}
System.out.println("Outside");
System.out.println(sbSplitData);
}
}
Here is some text from my file.
007 Date 1/04/13 Page 1
1 Account Number 1000000000
1 Enclosures
013 Test S.A.(Test)
1 URB. MARBELLA CALLE AQUILINO DE LA
1 GUARDIA CON CALLE 47 TORRE BANESCO
1 PISO 27 Y 28 CIUDAD DE PANAMA
1 PANAMA
024 As of 1/1/2013, funds in a noninterest-bearing transaction account (including an
1 IOLTA) will no longer receive unlimited deposit insurance coverage. They will be
1 insured to the legal maximum of $250,000 for each ownership category.
2 ................................ ACCOUNT DETAIL ...............................
0 ................................ ACCOUNT DETAIL ...............................
2 CHECKING ACCOUNT FRG AFFL BANK
0 CHECKING ACCOUNT FRG AFFL BANK Number of Enclosures 0
1 Account Number 1000007904 Statement Dates 1/04/13 thru 1/06/13
1 Previous Balance 50,226.18 Days in the statement period 3
1 10 Deposits/Credits 338,888.67 Average Ledger 50,768.40
1 30 Checks/Debits 338,246.00 Average Collected 50,768.40
1 Total Fees .00
1 Interest Paid .00
1 Current Balance 50,868.85
3 Deposits and Additions
0 Deposits and Additions
1 Date Description Amount Refe
0 Date Description Amount Refe
1 1/04 WIRE-IN 20130040042300 ATLANTI 300,000.00
1 OBI:
1 1/04 WIRE-IN 20130040038800 1/CARVA 4,295.00
1 OBI:
1 1/04 WIRE-IN 20130030004900 NEW CHA 1,563.67
1 OBI:PENSION MES DE DICIEMBRE D
1 1/04 INTERNAL TRF 20130040011800 13,995.00
007 Date 1/04/13 Page 2
1 Account Number 1000000000
1 Enclosures
024 CHECKING ACCOUNT FRG AFFL BANK 1000007904 (Continued)
2 Checks and Withdrawals
0 Checks and Withdrawals
1 Date Description Amount Refe
0 Date Description Amount Refe
1 1/04 Transfer to DDA 292,000.00-
1 Acct No. 1000007896-D
1 1/04 WIRE-IN 20130040024900 CARLOS 5,000.00-
1 OBI:REINTEGRO NESTMARY
1 1/04 WIRE-IN 20130040025100 ELIZABE 5,000.00-
1 OBI:PAGO POR ACTIVIDADES DEPOR
1 1/04 WIRE-IN 20130040027100 COOPERA 2,622.00-
1 OBI:PAGO
1 1/04 WIRE-IN 20130040025900 INGENIA 2,550.00-
1 OBI:PRESTAMO EFECTIVO
1 1/04 WIRE-IN 20130040013100 JULIANO 2,500.00-
1 OBI:
1 1/04 WIRE-IN 20130040013000 MARIA I 2,089.57-
1 OBI:
1 1/04 WIRE-IN 20130040013300 JESUS A 2,012.00-
1 1/04 WIRE-IN 20130040018000 JOSE FR 200.00-
1 OBI:
1 1/04 WIRE-IN 20130040027800 EVELYN 100.00-
1 OBI:
2 Daily Balance Information
0 Daily Balance Information
1 Date Balance
0 Date Balance
1 1/04 50,868.85
2 For more information about FDIC insurance coverage, visit
1 http://www.fdic.gov/deposit/deposits/unlimited/expiration.html
007 Date 1/04/13 Page 1
1 Account Number 1000000000
1 Enclosures 25
013 Test
1 7A AVENIDA 11-59 ZONA 9
1 EDIFICIO GALERIAS ESPAÑA
1 GUATEMALA CITY
1 GUATEMALA
024 As of 1/1/2013, funds in a noninterest-bearing transaction account (including an
1 IOLTA) will no longer receive unlimited deposit insurance coverage. They will be
1 insured to the legal maximum of $250,000 for each ownership category.
2 ................................ ACCOUNT DETAIL ...............................
0 ................................ ACCOUNT DETAIL ...............................
2 FINANCIAL INSTITUTIONS
0 FINANCIAL INSTITUTIONS Number of Enclosures 25
1 Account Number 1000059038 Statement Dates 1/01/13 thru 1/06/13
1 Previous Balance 2,290,044.74 Days in the statement period 6
1 7 Deposits/Credits 952,853.71 Average Ledger 1,836,411.23
1 33 Checks/Debits 1,522,979.73 Average Collected 1,836,411.23
1 Total Fees .00
1 Interest Paid .00
1 Current Balance 1,719,918.72
3 Deposits and Additions
0 Deposits and Additions
1 Date Description Amount Refe
0 Date Description Amount Refe
1 1/02 WIRE-IN 20130020001800 ONMOBIL 2,500.00
1 OBI:FOR THE FINAL CREDIT OF AN
1 1/02 WIRE-IN 20130020009400 VIGO RE 114.00
1 OBI:VIGO SETTLEMENT GTV14
1 1/03 WIRE-IN 20130030030100 BANCO I 800,000.00
1 OBI:TRASLADO DE FONDOS DE SU C
1 1/03 WIRE-IN 20130030013700 MR BEYN 1,324.90
1 OBI:C/C 17026009260 ANA ANGELI
1 1/03 Remote Deposit Capture Deposit 70,725.00
1 1/04 WIRE-IN 20130040010500 VIGO RE 10,826.73
1 OBI:VIGO SETTLEMENT GTV14
1 1/04 Remote Deposit Capture Deposit 67,363.08
2 Checks and Withdrawals
0 Checks and Withdrawals
1 Date Description Amount Refe
0 Date Description Amount Refe
1 1/02 WIRE-IN 20130020023200 SAN LAZ 394,020.00-
1 OBI:/RFB/ F/F/C TO ACCOUNT 569
1 1/02 WIRE-IN 20130020029300 UNISOUR 22,589.50-
1 OBI:/RFB/UNIVERSITY EXPENSES S
1 1/02 WIRE-IN 20130020029700 UNISOUR 10,020.00-
1 OBI:/RFB/DEPOSIT TO ACCOUNT
1 1/02 7367* 17,000.00 1/03 7397 15,000.00
1 1/04 7370* 100,000.00 1/04 7403* 20,000.00
1 1/03 7371 20,000.00
1 * Denotes missing check numbers
2 Daily Balance Information
0 Daily Balance Information
1 Date Balance
0 Date Balance Date Balance
0 Date Balance
1 1/01 2,290,044.74 1/03 1,816,672.91
1 1/02 1,751,993.61 1/04 1,719,918.72
2 For more information about FDIC insurance coverage, visit
1 http://www.fdic.gov/deposit/deposits/unlimited/expiration.html
007 Date 1/04/13 Page 1
1 Account Number 1000000000
1 Enclosures
013 Test
1 (SETTELMENT VISA ACCOUNT)
1 7A AVENIDA 11-59 ZONA 9
1 EDIFICIO GALERIAS ESPAÑA
1 GUATEMALA CITY
1 GUATEMALA
024 As of 1/1/2013, funds in a noninterest-bearing transaction account (including an
1 IOLTA) will no longer receive unlimited deposit insurance coverage. They will be
1 insured to the legal maximum of $250,000 for each ownership category.
2 ................................ ACCOUNT DETAIL ...............................
0 ................................ ACCOUNT DETAIL ...............................
2 FINANCIAL INSTITUTIONS
0 FINANCIAL INSTITUTIONS Number of Enclosures 0
1 Account Number 1000062412 Statement Dates 1/01/13 thru 1/06/13
1 Previous Balance 385,002.47 Days in the statement period 6
1 Deposits/Credits .00 Average Ledger 374,620.47
1 7 Checks/Debits 15,367.65 Average Collected 374,620.47
1 Total Fees .00
1 Interest Paid .00
1 Current Balance 369,634.82
3 Checks and Withdrawals
0 Checks and Withdrawals
1 Date Description Amount Refe
0 Date Description Amount Refe
1 1/02 WIRE-OUT 20130020006601 6,293.81-
1 OBI:4423210000 VSS SETTLEMENT
1 1/02 WIRE Out Fee 20.00-
1 1/03 WIRE-OUT 20130030011401 3,541.38-
1 OBI:4423210000 VSS SETTLEMENT
1 1/03 WIRE Out Fee 20.00-
1 1/04 Account Service Fee Corresp.Bk 80.00-
1 1/04 WIRE-OUT 20130040010401 5,392.46-
1 OBI:4423210000 VSS SETTLEMENT
1 1/04 WIRE Out Fee 20.00-
2 Daily Balance Information
0 Daily Balance Information
1 Date Balance
0 Date Balance Date Balance
0 Date Balance
1 1/01 385,002.47 1/03 375,127.28
1 1/02 378,688.66 1/04 369,634.82
2 For more information about FDIC insurance coverage, visit
1 http://www.fdic.gov/deposit/deposits/unlimited/expiration.html
Waiting for any suggestion or help.
Thanks in advance...
Simple basic idea is create a ArrayList.
Create a StringBuffer add string from newLine method if its not contain "Page 1".
If string returned by newLine method contain "Page 1" then add StringBuffer into arraylist and create new StringBuffer . and do same step 2 again .
For some suggestion: lastIndexOf and also you can take a try for contains method.
List<StringBuffer> list = new ArrayList<StringBuffer>();
StringBuffer sb = new StringBuffer();
int i = 1; // I think page no is changing form 1 to ...
while (readerSplit.hasNextLine()) {
String sLineDataSplit = readerSplit.nextLine().trim();
// take a look for lastIndexOf function.
if (sLineDataSplit.lastIndexOf("Page "+i)==9 && sb.length()>0) {
list.add(sb);
sb = new StringBuffer();
sb.append(sLineDataSplit);
i++; // to get the next page
}
else{
sb.append(sLineDataSplit);
}
}

Categories

Resources