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.
33 lines
459 B
33 lines
459 B
package rocron
|
|
|
|
import "fmt"
|
|
|
|
func concatenateStrings(day int) string {
|
|
var result string
|
|
if day > 1 {
|
|
result += "1"
|
|
}
|
|
for i := 1; i <= 31; i++ {
|
|
if isDivisibleBy(i, day) {
|
|
if len(result) > 0 {
|
|
result += ","
|
|
}
|
|
result += fmt.Sprintf("%d", i)
|
|
}
|
|
}
|
|
|
|
return result
|
|
}
|
|
|
|
func isDivisibleBy(num, divisor int) bool {
|
|
return num%divisor == 0
|
|
}
|
|
|
|
func removeFirstTwoChars(str string) string {
|
|
if len(str) > 2 {
|
|
return str[2:]
|
|
}
|
|
|
|
return ""
|
|
}
|