HiveBrain v1.2.0
Get Started
← Back to all entries
snippetgoCritical

How do I convert a string to a lower case representation?

Submitted by: @import:stackoverflow-api··
0
Viewed 0 times
howrepresentationconvertstringcaselower

Problem

How do I convert a string to a lower case representation?

I feel that there must be built-in function for it, but I just can't find it.

I did find a ToLower in "unicode/letter", but it only works for one rune at a time.

Solution

Yes there is, check the strings package.

package main

import (
    "fmt"
    "strings"
)

func main() {
    fmt.Println(strings.ToLower("Gopher"))
}

Code Snippets

package main

import (
    "fmt"
    "strings"
)

func main() {
    fmt.Println(strings.ToLower("Gopher"))
}

Context

Stack Overflow Q#10411538, score: 191

Revisions (0)

No revisions yet.