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.
46 lines
741 B
46 lines
741 B
5 years ago
|
package main
|
||
|
|
||
|
import (
|
||
5 years ago
|
"fmt"
|
||
5 years ago
|
"os"
|
||
|
"strconv"
|
||
5 years ago
|
"unicode"
|
||
5 years ago
|
)
|
||
|
|
||
5 years ago
|
func IsNumeric(s string) bool {
|
||
|
for _, r := range s {
|
||
|
if !unicode.IsDigit(r) {
|
||
5 years ago
|
return false
|
||
|
}
|
||
|
}
|
||
|
return true
|
||
|
}
|
||
|
|
||
|
func main() {
|
||
|
arguments := os.Args[1:]
|
||
|
for i := range arguments {
|
||
|
if IsNumeric(arguments[i]) {
|
||
|
number, _ := strconv.Atoi(arguments[i])
|
||
|
boole := false
|
||
|
if os.Args[1] == "--upper" {
|
||
|
boole = true
|
||
|
}
|
||
|
|
||
|
if number <= 26 && number >= 1 && !boole {
|
||
|
number += 96
|
||
5 years ago
|
fmt.Printf("%c", rune(number))
|
||
5 years ago
|
} else if number <= 26 && number >= 1 && boole {
|
||
|
number += 64
|
||
5 years ago
|
fmt.Printf("%c", rune(number))
|
||
5 years ago
|
} else {
|
||
5 years ago
|
fmt.Print(" ")
|
||
5 years ago
|
}
|
||
|
} else {
|
||
|
if !(arguments[i] == "--upper" && i == 0) {
|
||
5 years ago
|
fmt.Print(" ")
|
||
5 years ago
|
}
|
||
|
}
|
||
|
}
|
||
5 years ago
|
fmt.Println()
|
||
5 years ago
|
}
|