mirror of https://github.com/01-edu/public.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
795 B
43 lines
795 B
5 years ago
|
package main
|
||
5 years ago
|
|
||
|
import (
|
||
5 years ago
|
"github.com/01-edu/z01"
|
||
|
|
||
5 years ago
|
correct "./correct"
|
||
5 years ago
|
student "./student"
|
||
|
)
|
||
|
|
||
5 years ago
|
func stringsToTrimAtoi(a []string) []string {
|
||
|
alpha := "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789012345678901234567890123456789"
|
||
|
|
||
|
for index := 0; index < 4; index++ {
|
||
|
s := ""
|
||
|
s += z01.RandStr(z01.RandIntBetween(0, 2), alpha)
|
||
|
x := z01.RandIntBetween(0, 14)
|
||
|
if x <= 4 {
|
||
|
s += "-"
|
||
|
}
|
||
|
s += z01.RandStr(z01.RandIntBetween(0, 10), alpha)
|
||
|
a = append(a, s)
|
||
|
}
|
||
|
return a
|
||
|
}
|
||
|
|
||
5 years ago
|
func main() {
|
||
5 years ago
|
a := []string{
|
||
|
"",
|
||
5 years ago
|
"12345",
|
||
|
"str123ing45",
|
||
|
"012 345",
|
||
|
"Hello World!",
|
||
|
"sd+x1fa2W3s4",
|
||
|
"sd-x1fa2W3s4",
|
||
|
"sdx1-fa2W3s4",
|
||
5 years ago
|
z01.RandAlnum(),
|
||
5 years ago
|
}
|
||
5 years ago
|
a = stringsToTrimAtoi(a)
|
||
|
for _, elem := range a {
|
||
5 years ago
|
z01.Challenge("TrimAtoi", student.TrimAtoi, correct.TrimAtoi, elem)
|
||
5 years ago
|
}
|
||
|
}
|