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