normaize account input
Auto Tag on Version Change / check-version (push) Successful in 3s

This commit is contained in:
2026-05-17 21:45:49 +05:00
parent 04af4e1bbd
commit 389344a192
2 changed files with 16 additions and 1 deletions
@@ -11,6 +11,21 @@ object AccountInputParser {
UNKNOWN
}
/**
* Strip spaces and remove a 960/+960 country code prefix, but only when
* the stripped result is exactly 7 digits (so "9603456" is left intact).
*/
fun normalize(input: String): String {
var s = input.replace(" ", "")
val stripped = when {
s.startsWith("+960") -> s.removePrefix("+960")
s.startsWith("960") -> s.removePrefix("960")
else -> null
}
if (stripped != null && stripped.matches(Regex("^\\d{7}$"))) s = stripped
return s
}
fun detect(input: String): InputType {
val s = input.trim()
return when {