optimize account search in tranfer page
Auto Tag on Version Change / check-version (push) Successful in 3s

This commit is contained in:
2026-05-15 19:25:26 +05:00
parent 253e5400d8
commit 4b6c5e5d8b
3 changed files with 39 additions and 3 deletions
@@ -0,0 +1,25 @@
package sh.sar.basedbank.util
object AccountInputParser {
enum class InputType {
MIB_ACCOUNT, // 17 digits starting with 9
BML_ACCOUNT, // 13 digits starting with 7
PHONE, // 7 digits starting with 7 or 9
NATIONAL_ID, // A followed by 6 digits
EMAIL,
UNKNOWN
}
fun detect(input: String): InputType {
val s = input.trim()
return when {
s.matches(Regex("^9\\d{16}$")) -> InputType.MIB_ACCOUNT
s.matches(Regex("^7\\d{12}$")) -> InputType.BML_ACCOUNT
s.matches(Regex("^[79]\\d{6}$")) -> InputType.PHONE
s.matches(Regex("^[Aa]\\d{6}$")) -> InputType.NATIONAL_ID
s.contains("@") -> InputType.EMAIL
else -> InputType.UNKNOWN
}
}
}