Forgot a function.
This commit is contained in:
parent
b83d6bdde4
commit
2461f5b417
@ -6,19 +6,6 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Validate if the char provided is 0-9
|
|
||||||
func (flags *Flags) validChar(char rune) (valid bool) {
|
|
||||||
decvals := [10]int{48, 49, 50, 51, 52, 53, 54, 55, 56, 57}
|
|
||||||
|
|
||||||
for _, value := range decvals {
|
|
||||||
if char == rune(value) {
|
|
||||||
valid = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Print help information for the end-user
|
// Print help information for the end-user
|
||||||
func (flags *Flags) printUsage() {
|
func (flags *Flags) printUsage() {
|
||||||
fmt.Fprintf(flag.CommandLine.Output(), "Usage of %s:\n", os.Args[0])
|
fmt.Fprintf(flag.CommandLine.Output(), "Usage of %s:\n", os.Args[0])
|
||||||
|
14
flags/validChar.go
Normal file
14
flags/validChar.go
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
package flags
|
||||||
|
|
||||||
|
// Validate if the char provided is 0-9
|
||||||
|
func (flags *Flags) validChar(char rune) (valid bool) {
|
||||||
|
decvals := [10]int{48, 49, 50, 51, 52, 53, 54, 55, 56, 57}
|
||||||
|
|
||||||
|
for _, value := range decvals {
|
||||||
|
if char == rune(value) {
|
||||||
|
valid = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user