public static Version of()

in dekaf-inter/src/utils/Version.java [51:72]


  public static Version of(@NotNull final String string) {
    ArrayList<Integer> b = new ArrayList<Integer>(5);
    final String[] substrings = string.split("[.,\\-_ ]|(?<=\\d)(?!\\d)|(?<!\\d)(?=\\d)");
    for (String ss : substrings) {
      String ss2 = ss.trim().toLowerCase(Locale.ENGLISH);
      if (ss2.isEmpty()) continue;
      Integer special = SPECIAL_VALUES.get(ss2);
      if (special != null) b.add(special);
      else {
        try {
          Integer v = Integer.valueOf(ss2);
          b.add(v);
        } catch (NumberFormatException e) {
          break;
        }
      }
    }
    if (b.isEmpty()) throw new IllegalArgumentException("Failed to parse version \""+string+"\"");
    if (b.size() == 1 && b.get(0) == 0) return ZERO;

    return of(b.toArray(new Integer[b.size()]));
  }