go-arbitrary/t_phonenumber_canada.go

118 lines
1.5 KiB
Go
Raw Normal View History

2021-11-21 01:46:15 +00:00
package arbitrary
import (
"fmt"
)
func (arb T) phonenumber_canada() string {
var areacode string
{
var areacodes []string = []string{
2021-11-21 14:12:56 +00:00
// alberta
"403",
"780",
"587",
"825",
"368",
// british columnbia
2021-11-21 01:46:15 +00:00
"604",
"250",
"778",
"236",
"672",
2021-11-21 14:12:56 +00:00
// manitoba
"204",
"413",
// new brunswick
"506",
// newfoundland and labrador
"709",
// nova scotia and prince edward island
"782",
"902",
// ontario
"226",
"249",
"289",
"343",
"365",
"416",
"437",
"519",
"548",
"613",
"647",
"705",
"807",
"905",
// quebec
"367",
"418",
"581",
"438",
"450",
"514",
"613",
"581",
"819",
// saskatchewan
"306",
"639",
// yukon, northwest territories and nunavut
"867",
2021-11-21 01:46:15 +00:00
}
areacode = areacodes[arb.randomness.Intn(len(areacodes))]
}
2021-11-21 16:27:42 +00:00
var localpart1 int
2021-11-21 01:46:15 +00:00
{
2021-11-21 16:27:42 +00:00
localpart1 = arb.randomness.Intn(1000)
2021-11-21 01:46:15 +00:00
}
2021-11-21 16:27:42 +00:00
var localpart2 int
2021-11-21 01:46:15 +00:00
{
2021-11-21 16:27:42 +00:00
localpart2 = arb.randomness.Intn(10000)
2021-11-21 01:46:15 +00:00
}
var format string
{
var formats []string = []string{
2021-11-21 16:27:42 +00:00
"%s-%03d%04d",
"%s-%03d-%04d",
"%s %03d %04d",
"%s %03d%04d",
"(%s) %03d%04d",
"(%s)%03d%04d",
"(%s) %03d-%04d",
"(%s)%03d-%04d",
"(%s) %03d %04d",
"(%s)%03d %04d",
"%s/%03d-%04d",
"+1%s%03d%04d",
"+1-%s-%03d-%04d",
"+1 %s %03d %04d",
2021-11-21 01:46:15 +00:00
}
format = formats[arb.randomness.Intn(len(formats))]
}
var result string
{
2021-11-21 14:12:56 +00:00
result = fmt.Sprintf(format, areacode, localpart1, localpart2)
2021-11-21 01:46:15 +00:00
}
return result
}