@Test public void identifySymbianVersion() { final String sym70s = "Nokia6600/1.0 (3.38.0) SymbianOS/7.0s Series60/2.0 Profile/MIDP-2.0 Configuration/CLDC-1.0"; assertThat(VersionParser.identifySymbianVersion(sym70s).toVersionString()).isEqualTo("7.0s"); final String sym94 = "SonyEricssonU1i/R1BB; Mozilla/5.0 (SymbianOS/9.4; U; Series60/5.0 Profile/MIDP-2.1 Configuration/CLDC-1.1 model-orange) AppleWebKit/525 (KHTML, like Gecko) Version/3.0 Safari/525"; assertThat(VersionParser.identifySymbianVersion(sym94).toVersionString()).isEqualTo("9.4"); final String sym70 = "X700/1.0 SymbianOS/7.0 Series60/2.0 Profile/MIDP-2.0 Configuration/CLDC-1.0"; assertThat(VersionParser.identifySymbianVersion(sym70).toVersionString()).isEqualTo("7.0"); final String sym92 = "Mozilla/5.0 (SymbianOS/9.2; U; Series60/3.1 NokiaE71-1/300.21.012; Profile/MIDP-2.0 Configuration/CLDC-1.1 ) AppleWebKit/413 (KHTML, like Gecko) Safari/413"; assertThat(VersionParser.identifySymbianVersion(sym92).toVersionString()).isEqualTo("9.2"); final String sym61 = "6600/1.0 (Profile/MIDP-1.0 Configuration/CLDC-1.0; Series60/0.9; SymbianOS/6.1)"; assertThat(VersionParser.identifySymbianVersion(sym61).toVersionString()).isEqualTo("6.1"); }
static VersionNumber identifySymbianVersion(final String userAgent) { VersionNumber version = VersionNumber.UNKNOWN; final Pattern pattern = Pattern.compile("SymbianOS/((\\d+)((\\.\\d+)+)?s?)"); final Matcher m = pattern.matcher(userAgent); if (m.find()) { version = parseFirstVersionNumber(m.group(MAJOR_INDEX)); } return version; }
VersionParser { static VersionNumber identifySymbianVersion(final String userAgent) { VersionNumber version = VersionNumber.UNKNOWN; final Pattern pattern = Pattern.compile("SymbianOS/((\\d+)((\\.\\d+)+)?s?)"); final Matcher m = pattern.matcher(userAgent); if (m.find()) { version = parseFirstVersionNumber(m.group(MAJOR_INDEX)); } return version; } }
VersionParser { static VersionNumber identifySymbianVersion(final String userAgent) { VersionNumber version = VersionNumber.UNKNOWN; final Pattern pattern = Pattern.compile("SymbianOS/((\\d+)((\\.\\d+)+)?s?)"); final Matcher m = pattern.matcher(userAgent); if (m.find()) { version = parseFirstVersionNumber(m.group(MAJOR_INDEX)); } return version; } private  VersionParser(); }
VersionParser { static VersionNumber identifySymbianVersion(final String userAgent) { VersionNumber version = VersionNumber.UNKNOWN; final Pattern pattern = Pattern.compile("SymbianOS/((\\d+)((\\.\\d+)+)?s?)"); final Matcher m = pattern.matcher(userAgent); if (m.find()) { version = parseFirstVersionNumber(m.group(MAJOR_INDEX)); } return version; } 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 { static VersionNumber identifySymbianVersion(final String userAgent) { VersionNumber version = VersionNumber.UNKNOWN; final Pattern pattern = Pattern.compile("SymbianOS/((\\d+)((\\.\\d+)+)?s?)"); final Matcher m = pattern.matcher(userAgent); if (m.find()) { version = parseFirstVersionNumber(m.group(MAJOR_INDEX)); } return version; } 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);  }