Littera extends OkHttpSearchOnlyApi { static int parseTotalResults(final String navigation) { final Matcher matcher = Pattern.compile("(von|of) (\\d+)|(\\d+) sonu\\u00e7tan") .matcher(navigation); if (matcher.find()) { final String num1 = matcher.group(2); return Integer.parseInt(num1 != null ? num1 : matcher.group(3)); } else { return 0; } }  @Override void init(Library library, HttpClientFactory httpClientFactory); @Override SearchRequestResult search(List<SearchQuery> query); @Override SearchRequestResult searchGetPage(int page); @Override DetailedItem getResultById(String id, String homebranch); @Override SearchRequestResult filterResults(Filter filter, Filter.Option option); @Override DetailedItem getResult(int position); @Override List<SearchField> parseSearchFields(); @Override String getShareUrl(String id, String title); @Override int getSupportFlags(); @Override Set<String> getSupportedLanguages(); @Override void setLanguage(String language);  }
@Test public void testParseTotalResults() { assert Littera.parseTotalResults("Treffer pro Seite • 1 - 10 von 46 Treffern") == 46; assert Littera.parseTotalResults("Hits per page • 1 - 10 of 46") == 46; assert Littera.parseTotalResults("Sayfa başına sonuç • 46 sonuçtan 1 - 10") == 46; }