File tree Expand file tree Collapse file tree
swapi-sdk/src/main/java/net/gotev/swapi/extensions Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package net.gotev.swapi.extensions
22
3+ import net.gotev.swapi.SwapiOrigin
34import net.gotev.swapi.models.Manufacturer
5+ import net.gotev.swapi.swapiClient
46import java.util.Locale
57
68fun String.asCSVList () = split(" ," ).map { it.trim() }
@@ -9,7 +11,11 @@ fun String.asLintedLowercaseCSVList() = asCSVList()
911 .map { it.split(" /" ) }
1012 .flatten() // theed palace space vessel engineering corps/nubia star drives
1113
12- fun String.pageNumber () = split(" =" ).getOrNull(1 )?.toInt()
14+ fun String.pageNumber () = if (swapiClient is SwapiOrigin ) {
15+ split(" =" ).getOrNull(1 )?.toInt()
16+ } else {
17+ split(" page" ).getOrNull(1 )?.replace(" .json" , " " )?.toInt()
18+ }
1319
1420internal fun String.lintManufacturer () = when (val linted = replace(" ." , " " )) {
1521 " incom" -> Manufacturer .IncomCorporation .rawValue
You can’t perform that action at this time.
0 commit comments