phone number

master
Charles Iliya Krempeaux 2021-11-22 08:56:28 -08:00
parent e729970554
commit 7f4a6b624f
2 changed files with 32 additions and 1 deletions

View File

@ -2,6 +2,7 @@ package arbitrary
import ( import (
"fmt" "fmt"
"strings"
) )
func (arb T) phonenumber_egypt_3_4(areacode string) string { func (arb T) phonenumber_egypt_3_4(areacode string) string {
@ -31,6 +32,21 @@ func (arb T) phonenumber_egypt_3_4(areacode string) string {
result = fmt.Sprintf(format, areacode, localpart1, localpart2) result = fmt.Sprintf(format, areacode, localpart1, localpart2)
} }
{
if 0 == arb.randomness.Intn(4) {
result = strings.ReplaceAll(result, "0", "٠")
result = strings.ReplaceAll(result, "1", "١")
result = strings.ReplaceAll(result, "2", "٢")
result = strings.ReplaceAll(result, "3", "٣")
result = strings.ReplaceAll(result, "4", "٤")
result = strings.ReplaceAll(result, "5", "٥")
result = strings.ReplaceAll(result, "6", "٦")
result = strings.ReplaceAll(result, "7", "٧")
result = strings.ReplaceAll(result, "8", "٨")
result = strings.ReplaceAll(result, "9", "٩")
}
}
return result return result
} }

View File

@ -2,6 +2,7 @@ package arbitrary
import ( import (
"fmt" "fmt"
"strings"
) )
func (arb T) phonenumber_egypt_4_4(areacode string) string { func (arb T) phonenumber_egypt_4_4(areacode string) string {
@ -31,6 +32,20 @@ func (arb T) phonenumber_egypt_4_4(areacode string) string {
result = fmt.Sprintf(format, areacode, localpart1, localpart2) result = fmt.Sprintf(format, areacode, localpart1, localpart2)
} }
{
if 0 == arb.randomness.Intn(4) {
result = strings.ReplaceAll(result, "0", "٠")
result = strings.ReplaceAll(result, "1", "١")
result = strings.ReplaceAll(result, "2", "٢")
result = strings.ReplaceAll(result, "3", "٣")
result = strings.ReplaceAll(result, "4", "٤")
result = strings.ReplaceAll(result, "5", "٥")
result = strings.ReplaceAll(result, "6", "٦")
result = strings.ReplaceAll(result, "7", "٧")
result = strings.ReplaceAll(result, "8", "٨")
result = strings.ReplaceAll(result, "9", "٩")
}
}
return result return result
} }