Question

In: Computer Science

a file is comma delimited, what does this mean? Why is a delimiter helpful when reading...

a file is comma delimited, what does this mean? Why is a delimiter helpful when reading from a flat file of data?

Solutions

Expert Solution

The delimiters are useful while splitting the data in the file. The file is comma delimited means we can split the data in the file by using that comma. The delimiter is very helpful when reading the data from the flat files.

The following example will give you the best understanding of how the comma is useful when reading the data:

For example I have the employee.txt:

I would like to store the data in the as EID ENAME SALARY. Here I will use comma seperator.

employee.txt :

101,Jack,5000

102,Jane,6000

103,James,10000

104,Jordan,13000

when I am reading this file data :

FileReader fr = new FileReader("employee.txt");

BufferedReader br = new BufferedReader(fr);

String line = null;

String eid,ename,salary;

while((line=br.readLine)!=null){

String a[] = line.split(",");//The delimiter comma is useful in better accessing the data

eid = a[0];ename= a[1];salary=a[2];

System.out.println("EID:"+eid+" ENAME:"+ename+" SALARY :"+salary);

}


Related Solutions

The data set 2017NBADraft.txt is a comma delimited file containing data on the players selected in...
The data set 2017NBADraft.txt is a comma delimited file containing data on the players selected in the 2017 NBA draft. Assume this data set is a representative sample of all players in the NBA. Correctly import the data set into R. c) In R, perform a hypothesis test to determine if the mean weights are different for the first round selections and second round selections. To do this, create a new variable so that the first 30 players all have...
What does ‘file mounting’ mean?
What does ‘file mounting’ mean?
[Critical Reading] 1. What does it mean and take to be a critical reader? 2. Why...
[Critical Reading] 1. What does it mean and take to be a critical reader? 2. Why is critical reading considered an active process of discovery? 3. Why is critical reading important and in what way is critical reading related to critical writing? 4. What are the different ways to become a critical reader?
What is the hash value of a file, and what does it mean if two files...
What is the hash value of a file, and what does it mean if two files have the same hash value?
What does the term body burden mean? Why is this important to know when you are...
What does the term body burden mean? Why is this important to know when you are discussing toxic exposure?
What does the term calibration mean and why it is important when using any sort of...
What does the term calibration mean and why it is important when using any sort of measurement equipment ?
what does it mean when the offspring decreased?
what does it mean when the offspring decreased?
What does it mean when culture is commodified?
What does it mean when culture is commodified?What is the impact on intercultural communication?Explain and provide an example.
What does it mean when LSCs are quiescent?
What does it mean when LSCs are quiescent?
What does CGIAR mean? When was it founded?
What does CGIAR mean? When was it founded?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT