mirror of
https://github.com/bbernhard/signal-cli-rest-api.git
synced 2026-05-30 15:24:15 +00:00
added IsPhoneNumber helper function to utils
This commit is contained in:
parent
82fd577d48
commit
9fad77c922
@ -31,3 +31,18 @@ func StringInSlice(a string, list []string) bool {
|
|||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func IsPhoneNumber(s string) bool {
|
||||||
|
for index, c := range s {
|
||||||
|
if index == 0 {
|
||||||
|
if c != '+' {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if c < '0' || c > '9' {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user