I want to extract minutes and seconds from duration
I have read a text file into BufferedReader
my first line and second has this information:
Quote:
Date Time Number Duration
01/01/2007 00:01 0202332981 1:04
How can I derive the minutes and seconds and save it to String minutes, seconds. This is an extract of code I have written so far:
Code :
String strLine;
//Read File Line By Line
while ((strLine = br.readLine()) != null) {
// What do I do with strLine so the minutes and seconds are extracted?
}
Thank you
Re: I want to extract minutes and seconds from duration
See the API for String. It has many helpful methods that you can use to parse those strings into what you want (indexOf, split, etc...). You could also use a StringTokenizer (Java Platform SE 6) to loop over the values in each line