Compare commits
1 commit
bb5417d37f
...
15b9a90db0
Author | SHA1 | Date | |
---|---|---|---|
15b9a90db0 |
1 changed files with 4 additions and 3 deletions
|
@ -9,11 +9,12 @@ data class LPAString(
|
|||
companion object {
|
||||
fun parse(input: String): LPAString {
|
||||
var token = input
|
||||
if (token.startsWith("LPA:", ignoreCase = true)) token = token.drop(4)
|
||||
if (token.startsWith("LPA:", true)) token = token.drop(4)
|
||||
val components = token.split('$').map { it.trim().ifBlank { null } }
|
||||
check(components.getOrNull(0) == "1") { "Invalid AC_Format" }
|
||||
check(components.size > 1) { "Invalid activation code format" }
|
||||
check(components[0] == "1") { "Invalid AC_Format" }
|
||||
return LPAString(
|
||||
checkNotNull(components.getOrNull(1)) { "SM-DP+ is required" },
|
||||
checkNotNull(components[1]) { "SM-DP+ is required" },
|
||||
components.getOrNull(2),
|
||||
components.getOrNull(3),
|
||||
components.getOrNull(4) == "1"
|
||||
|
|
Loading…
Add table
Reference in a new issue