MCPcopy Create free account
hub / github.com/FongMi/TV / split

Method split

app/src/leanback/java/com/fongmi/android/tv/utils/PartUtil.java:16–27  ·  view source on GitHub ↗
(String text)

Source from the content-addressed store, hash-verified

14 private static final Pattern PATTERN_YEAR = Pattern.compile("^(.*)(19|20)\\d{2}$");
15
16 public static List<String> split(String text) {
17 Set<String> items = new LinkedHashSet<>();
18 String[] rawSplits;
19 if (text.contains(":")) rawSplits = text.split(":");
20 else if (text.contains("第") && text.contains("季")) rawSplits = extractSeason(text);
21 else if (text.contains("(")) rawSplits = new String[]{text.split(Pattern.quote("("))[0]};
22 else if (text.contains(" ")) rawSplits = text.split(" ");
23 else rawSplits = extractYear(text);
24 items.add(text);
25 Arrays.stream(rawSplits).map(String::trim).map(s -> s.contains(" ") ? s.split(" ")[0].trim() : s).filter(s -> !s.isEmpty()).forEach(items::add);
26 return new ArrayList<>(items);
27 }
28
29 private static String[] extractSeason(String text) {
30 Matcher matcher = PATTERN_SEASON.matcher(text);

Callers 15

setPartAdapterMethod · 0.95
spiderFunction · 0.80
getStreamMethod · 0.80
cheerio.min.jsFile · 0.80
fFunction · 0.80
lrFunction · 0.80
sFunction · 0.80
GrFunction · 0.80
YrFunction · 0.80
JiFunction · 0.80
QaFunction · 0.80
JeFunction · 0.80

Calls 7

extractSeasonMethod · 0.95
extractYearMethod · 0.95
filterMethod · 0.80
streamMethod · 0.80
containsMethod · 0.45
addMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected