@Test public void parseLastVersionNumber_OOZBOT() { final String userAgent = "OOZBOT/0.20 ( Setooz výrazný ako say-th-uuz, znamená mosty. ; http: final String version = "0.20"; final VersionNumber v = VersionParser.parseLastVersionNumber(userAgent); assertThat(v.toVersionString()).isEqualTo(version); }
public static VersionNumber parseLastVersionNumber(@Nonnull final String text) { Check.notNull(text, "text"); final Matcher matcher = VERSIONNUMBER_WITH_SUFFIX.matcher(text); String[] split = null; String ext = null; while (matcher.find()) { split = matcher.group(MAJOR_INDEX).split("\\."); ext = matcher.group(EXTENSION_INDEX); } final String extension = ext == null ? VersionNumber.EMPTY_EXTENSION : trimRight(ext); return split == null ? VersionNumber.UNKNOWN : new VersionNumber(Arrays.asList(split), extension); }
VersionParser { public static VersionNumber parseLastVersionNumber(@Nonnull final String text) { Check.notNull(text, "text"); final Matcher matcher = VERSIONNUMBER_WITH_SUFFIX.matcher(text); String[] split = null; String ext = null; while (matcher.find()) { split = matcher.group(MAJOR_INDEX).split("\\."); ext = matcher.group(EXTENSION_INDEX); } final String extension = ext == null ? VersionNumber.EMPTY_EXTENSION : trimRight(ext); return split == null ? VersionNumber.UNKNOWN : new VersionNumber(Arrays.asList(split), extension); } }
VersionParser { public static VersionNumber parseLastVersionNumber(@Nonnull final String text) { Check.notNull(text, "text"); final Matcher matcher = VERSIONNUMBER_WITH_SUFFIX.matcher(text); String[] split = null; String ext = null; while (matcher.find()) { split = matcher.group(MAJOR_INDEX).split("\\."); ext = matcher.group(EXTENSION_INDEX); } final String extension = ext == null ? VersionNumber.EMPTY_EXTENSION : trimRight(ext); return split == null ? VersionNumber.UNKNOWN : new VersionNumber(Arrays.asList(split), extension); } private  VersionParser(); }
VersionParser { public static VersionNumber parseLastVersionNumber(@Nonnull final String text) { Check.notNull(text, "text"); final Matcher matcher = VERSIONNUMBER_WITH_SUFFIX.matcher(text); String[] split = null; String ext = null; while (matcher.find()) { split = matcher.group(MAJOR_INDEX).split("\\."); ext = matcher.group(EXTENSION_INDEX); } final String extension = ext == null ? VersionNumber.EMPTY_EXTENSION : trimRight(ext); return split == null ? VersionNumber.UNKNOWN : new VersionNumber(Arrays.asList(split), extension); } private  VersionParser(); static VersionNumber parseLastVersionNumber(@Nonnull final String text); static VersionNumber parseOperatingSystemVersion(@Nonnull final OperatingSystemFamily family, @Nonnull final String userAgent); static VersionNumber parseVersion(@Nonnull final String version); }
VersionParser { public static VersionNumber parseLastVersionNumber(@Nonnull final String text) { Check.notNull(text, "text"); final Matcher matcher = VERSIONNUMBER_WITH_SUFFIX.matcher(text); String[] split = null; String ext = null; while (matcher.find()) { split = matcher.group(MAJOR_INDEX).split("\\."); ext = matcher.group(EXTENSION_INDEX); } final String extension = ext == null ? VersionNumber.EMPTY_EXTENSION : trimRight(ext); return split == null ? VersionNumber.UNKNOWN : new VersionNumber(Arrays.asList(split), extension); } private  VersionParser(); static VersionNumber parseLastVersionNumber(@Nonnull final String text); static VersionNumber parseOperatingSystemVersion(@Nonnull final OperatingSystemFamily family, @Nonnull final String userAgent); static VersionNumber parseVersion(@Nonnull final String version);  }