How to convert a string in lower case in Golang?
In Go language, strings are different from other languages like Java, C++, Python, etc. It is a sequence of variable-width characters where each and every character is represented by one or more bytes using UTF-8 Encoding.
In Go string, you are allowed to convert a string in the lowercase using ToLower() function. This function returns a copy of the given string in which all the Unicode letters mapped into lower case. This function is defined under strings package, so you have to import strings package in your program to access this function.
func ToLower(str string) string
Here, str represents a string which you want to convert to lowercase.
Strings (before): String 1: WelcomE, GeeksforGeeks** String 2: $$This is the, tuTorial oF Golang## String 3: HELLO! GOLANG String 4: lowercase conversion Strings (after): Result 1: welcome, geeksforgeeks** Result 2: $$this is the, tutorial of golang## Result 3: hello! golang Result 4: lowercase conversion
My Personal Notes arrow_drop_up
Please Login to comment...