Use a switch-case instead of if-spaghettis

master
jvoisin 5 years ago
parent 6b54086590
commit e1a8a3b752
  1. 13
      airsonic-main/src/main/java/org/airsonic/player/util/StringUtil.java

@ -267,18 +267,17 @@ public final class StringUtil {
}
String[] elements = s.split("_");
if (elements.length == 0) {
switch (elements.length) {
case 0:
return new Locale(s, "", "");
}
if (elements.length == 1) {
case 1:
return new Locale(elements[0], "", "");
}
if (elements.length == 2) {
case 2:
return new Locale(elements[0], elements[1], "");
}
default:
return new Locale(elements[0], elements[1], elements[2]);
}
}
/**
* URL-encodes the input value using UTF-8.

Loading…
Cancel
Save