Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners extracting column and sorting csv data alphabetically
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


abhishekgiri
extracting column and sorting csv data alphabetically
0 Answer(s)      4 months and 5 days ago
Posted in : Java Beginners


hi

here is my code and csv data save it as country.csv file

*Australia;AU;1.5 Thaialnd;TH;1.6 India;IN;1.7 Malaysia;ML;1.8 Japan;JP;1.9 Korea;KO;1.10 Bangladesh;BD;1.11 China;CN;1.12 Chile;CH;1.13 Brazil;BR;1.14 Portugal;PG;1.15 Netherlands;NL;1.16 Belgium;BE;1.17 Poland;PO;1.18 England;GB;1.19 Ireland;IR;1.20 Scotland;EN;1.21*

public class Csv {

public static void main(String[] args) throws Exception {

    String csv = "d:\\country.csv";
    String line = "";
    String splitby = ";";
    String s;
    BufferedReader br = new BufferedReader(new FileReader(csv));
    while ((line = br.readLine()) != null) {
        String[] country = line.split(splitby);
        for (int i = 0; i < country.length - 1; i++) {

            BufferedWriter bw = new BufferedWriter(new FileWriter(
                    "d:\\output.txt", true));

            s = country[i];
            System.out.println(country[i]);
            bw.write(s);
            bw.newLine();
            bw.flush();

            bw.close();

        }

    }
    br.close();
}

}


Advertisement
View Answers

Related Tutorials/Questions & Answers:
extracting column and sorting csv data alphabetically
extracting column and sorting csv data alphabetically  hi here is my code and csv data save it as country.csv file *Australia;AU;1.5 Thaialnd;TH...* public class Csv { public static void main(String[] args) throws Exception
Alphabetically sorting order
Alphabetically sorting order  Write a java program that takes a list of words from the command line and prints out the arguments in an alphabetically sorted order   Hi Friend, Try the following code: import
Advertisements
Sorting Country names alphabetically
Sorting Country names alphabetically  Hello, I have a list of country names in an array. I need a jsp code which will sort me the country names in an alphaberical order. It would be more useful when I get the coding using
HTML Form data into .CSV?
HTML Form data into .CSV?  how to store data from html form to csvfile in java
sorting and storing data
sorting and storing data   sorting and storing data in UITableView
sorting
sorting   write a program to arrange sorting in rows,column and diagonal
Exporting data from mysql into csv using jsp
Exporting data from mysql into csv using jsp  Hi friends.... I want to export the data from mysql to csv file using... i am having 30 columns in my... in csv file..if i export, am getting the csv file with all data in one row
Exporting data from mysql to csv file
Exporting data from mysql to csv file  Hi friends.... I want to export the data from mysql to csv file... i am having 30 columns in my database.. Eg- text1,text2,text3,....,upto text30... i want to export this data in csv file
sorting
sorting  write to a program to arrange the sorting in rows, column and digonal
Read text file to 2D array and sorting the second column
Read text file to 2D array and sorting the second column  we found.... when exams conducted fast 4 times.The first column is the student name and the second column is marks in tests.What we need to find is which student marks
ADT ,data structure (ArrayList), sorting
ADT ,data structure (ArrayList), sorting  Write a program to calculate a bonus for 10 employees of WAFA Supermarket. The program consists of an abstract class Employee. Each employee contains IC number, name, basicSalary
create dropdown cell in csv or excell from mysql data in php
create dropdown cell in csv or excell from mysql data in php  Hello sir i want to create drodown cell in csv from mysql data is this is possible or not? if this is posible please share answer or reference link Thanks
Sorting
Sorting  can any help me know which sorting algorithm java uses for sorting collection and arrays
How to save form data to a csv file using jquery or ajax
How to save form data to a csv file using jquery or ajax  Please let...=data.responseText; Now the problem is ,i should write form data to a csv file using ajax... this. i am able to read the csv file using this code if (window.XMLHttpRequest
sorting
sorting  how to do sorting without using bubble sort,selection sort
Expport data into CSV File using JDBC in Servlet
;JdbcCsvFile.java" to export data from database in to CSV file. Brief... .style1 { font-weight: bold; } Expport data into CSV File using JDBC in Servlet   
importing CSV data into Database in java when the no of columns are known using javacsv
importing CSV data into Database in java when the no of columns are known using javacsv   I have imported CSV data into postgres Database in java... that if the no of columns in the csv are not known then also i should be able to import
Export data into CSV File using Servlet
Export data into CSV File using Servlet  ... to Export data into  CSV file using Servlet. We have created  file "JdbcCsvFile.java" to export data from this .java file.. Brief
how to save html form data into .csv file using only jsp.
how to save html form data into .csv file using only jsp.  Dear all, I am developing a website only using jsp and html. i need to save the form data into a .csv file using jsp. can anyone give me any sample solution or tutorial
CSV tables
CSV tables  hello, What are CSV tables?   hii, CSV Tables cannot be indexed.CSV Tables are the special tables, data for which is saved into comma-separated values files
insert data 50 row *column into 300 row *column by using xls sheet data (50 row *column) are given in xls sheet
insert data 50 row *column into 300 row *column by using xls sheet data (50 row *column) are given in xls sheet   1- there are matrix of data with 300 row and 300 column,this is master table we have input data 50 row and 50
convert excel file data into different locales while converting exclile file to csv file
convert excel file data into different locales while converting exclile file to csv file   can any one provide the code for how to convert excel file data into different locales while converting exclile file to csv file
sorting and filtering the displayed table data using jsp and xml
sorting and filtering the displayed table data using jsp and xml  I have created a xml file and a jsp file, which uses DOM parser to display the content of xml file in web page. Now I would like to sort and filter those data
Export Data into CSV file uing JDBC in JSP
Export Data into CSV file uing JDBC in JSP       CSV file : A CSV file is commonly known... : 3.Create a Page ("CsvJdbcFile.jsp") to export data into  CSV
group by sorting
group by sorting  group by sorting of data in SQL
Retrieve Data from CSV file in JSP
Retrieve Data from CSV file in JSP       CSV file : A CSV file is commonly known as a Comma... a Page ("ReadCsvFile.jsp") to retrieve the data from CSV file "
Sorting data in a jsp using a servlet while implementing comparable - JSP-Servlet
Sorting data in a jsp using a servlet while implementing comparable  Hi Sorry for being not so clear before. I have 3 records in my database. I... it for sorting. Bellow is its code: /* * To change this template, choose Tools
How to copy existing column along with data and column name into another existing table
How to copy existing column along with data and column name into another existing table  i want to copy the existing column along with data... way to copy both column name and data
Html Parsing Extracting Content
Html Parsing Extracting Content  Hello i need to parse html and search for a string and get its attributes.For example 'xxx' is my search string. i search html page and find xxx css attributes.Java,php,javascript is okey thank
Extracting equation from any document
Extracting equation from any document  how can i extract equation from any word document?   Hello Friend, If you want to extract data from the word file, then visit the following link: Extract data from word document
Extracting variable from jsp
Extracting variable from jsp  how to Write a java program which will be extracting the variables and putting them in an excel format?   ...(); out.println("Data is saved in excel file."); }catch ( Exception ex ){ } %>
 

 

 

DMCA.com