Home Software Engineering How you can UpperCase a String in Golang

How you can UpperCase a String in Golang

0
How you can UpperCase a String in Golang

[ad_1]

In Go, there are a number of methods to make a string UpperCase, every of them are by utilizing the strings bundle.

Possibility 1 (strings.ToUpper):

func ToUpper(str string) string

bundle principal

import (
    "fmt"
    "strings"
)

func principal() {
    str1 := "This can be a Check"
    fmt.Println(strings.ToUpper(str1))

    // "THIS IS A TEST"
}

Possibility 2 (strings.ToTitle):

func ToTitle(str string) string

bundle principal

import (
    "fmt"
    "strings"
)

func principal() {
    str1 := "This can be a Check"
    fmt.Println(strings.ToTitle(str1))

    // "THIS IS A TEST"
}

[ad_2]

LEAVE A REPLY

Please enter your comment!
Please enter your name here