Go language program to convert given string to upper case

Views: 121   

Following program shows you how to convert given string to upper case.
In this program we get string from user and convert that string to upper case using strings.ToUpper()

package main

import "fmt"
import "strings"

func main() {

  var input string 
  var upperCase string 
  fmt.Println("Please enter a string:")
  fmt.Scanf("%s", &input)
  upperCase = strings.ToUpper(input)
  fmt.Println("Given string to upper case: " , upperCase)
}

Output:

Please enter a string:
 hello
Given string to upper case:  HELLO
On By