extension fix
This commit is contained in:
parent
d0fd62abf2
commit
b4093b0c47
4 changed files with 34 additions and 8 deletions
|
@ -0,0 +1,20 @@
|
|||
package ani.dantotsu.media.anime
|
||||
|
||||
import java.util.regex.Matcher
|
||||
import java.util.regex.Pattern
|
||||
|
||||
class AnimeNameAdapter {
|
||||
companion object {
|
||||
fun findSeasonNumber(text: String): Int? {
|
||||
val seasonRegex = "(season|s)[\\s:.\\-]*(\\d+)"
|
||||
val seasonPattern: Pattern = Pattern.compile(seasonRegex, Pattern.CASE_INSENSITIVE)
|
||||
val seasonMatcher: Matcher = seasonPattern.matcher(text)
|
||||
|
||||
return if (seasonMatcher.find()) {
|
||||
seasonMatcher.group(2)?.toInt()
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue