refactor split time parsing
This commit is contained in:
parent
49b72cbe5d
commit
8a4afe2548
|
@ -31,20 +31,16 @@ public class YoutubeParsingHelper {
|
||||||
public static long parseDurationString(String input)
|
public static long parseDurationString(String input)
|
||||||
throws ParsingException, NumberFormatException {
|
throws ParsingException, NumberFormatException {
|
||||||
|
|
||||||
String[] splitInput;
|
|
||||||
|
|
||||||
// If time separator : is not detected, try . instead
|
// If time separator : is not detected, try . instead
|
||||||
|
|
||||||
if (input.contains(":")) {
|
final String[] splitInput = input.contains(":")
|
||||||
splitInput = input.split(":");
|
? input.split(":")
|
||||||
} else {
|
: input.split("\\.");
|
||||||
splitInput = input.split("\\.");
|
|
||||||
}
|
|
||||||
|
|
||||||
String days = "0";
|
String days = "0";
|
||||||
String hours = "0";
|
String hours = "0";
|
||||||
String minutes = "0";
|
String minutes = "0";
|
||||||
String seconds;
|
final String seconds;
|
||||||
|
|
||||||
switch (splitInput.length) {
|
switch (splitInput.length) {
|
||||||
case 4:
|
case 4:
|
||||||
|
|
Loading…
Reference in New Issue