Skip to content

Instantly share code, notes, and snippets.

@complxalgorithm
Last active May 8, 2016 04:59
Show Gist options
  • Save complxalgorithm/3fcc896821c47c4b3e5dafc6386fa940 to your computer and use it in GitHub Desktop.
Save complxalgorithm/3fcc896821c47c4b3e5dafc6386fa940 to your computer and use it in GitHub Desktop.
Golang script that will write capitalized version of all input text.
package main
import (
"bufio"
"fmt"
"os"
"strings"
)
func main() {
scanner := bufio.NewScanner(os.Stdin)
for scanner.Scan() {
ucl := strings.ToUpper(scanner.Text())
fmt.Println(ucl)
}
if err := scanner.Err(); err != nil {
fmt.Fprintln(os.Stderr, "error:", err)
os.Exit(1)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment