Answer the question
In order to leave comments, you need to log in
How to parse the format string 00:00:00.00 into an array of 4 values?
Actually the whole point is in the question itself. There is a time string hours:minutes:seconds.hundredths_of_seconds. You need to parse this value and calculate the total number of milliseconds.
Did it like this:
var tags = '01:10:01.10';
var re = /\s*:\s*/;
var re2 = /\s*.\s*/;
var tagList = tags.split(re);
var tagList2 = tagList['2'].split(re2);
var ms = (parseInt(tagList['0']*3600000))+(parseInt(tagList['1']*60000))+(parseInt(tagList2['0']*1000))+(parseInt(tagList2['1']*10));
Answer the question
In order to leave comments, you need to log in
Repeat 4 times: read two bytes, enter where necessary. We read 1 more byte, check that it is ":", shift the read position by 3. Add some checks for invalid lines and PROFIT!
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question