mirror of
https://github.com/aljazceru/signal-cli-rest-api.git
synced 2025-12-24 01:54:22 +01:00
added IsPhoneNumber helper function to utils
This commit is contained in:
@@ -31,3 +31,18 @@ func StringInSlice(a string, list []string) bool {
|
||||
}
|
||||
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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user