Golang strings.ToLowerSpecial() Function with Examples

Golang | strings.ToLowerSpecial() Function: Here, we are going to learn about the ToLowerSpecial() function of the strings package with its usages, syntax, and examples.
Submitted by IncludeHelp, on August 23, 2021

strings.ToLowerSpecial()

The ToLowerSpecial() function is an inbuilt function of strings package which is used to get a copy of the string with all Unicode letters mapped to their lower case using the case mapping specified by unicode.SpecialCase type. It accepts two parameters – a unicode.SpecialCase type and a string, and returns the string with all Unicode letters mapped to their lower case based on the given SpecialCase type.

Syntax:

func ToLowerSpecial(c unicode.SpecialCase, str string) string

Parameter(s):

  • c : To specify the unicode.SpecialCase type.
  • str : The string to be used to get the lowercase.

Return Value:

The return type of ToLowerSpecial() function is a string, it returns a copy of the string with all Unicode letters mapped to their lower case using the case mapping specified by unicode.SpecialCase type.

Example 1:

// Golang program to demonstrate the
// example of strings.ToLowerSpecial() Function

package main

import (
	"fmt"
	"strings"
	"unicode"
)

func main() {
	fmt.Println(strings.ToLowerSpecial(unicode.TurkishCase, "Selam Dünya"))
	fmt.Println(strings.ToLowerSpecial(unicode.TurkishCase, "İyi Cümleler"))
}

Output:

selam dünya
iyi cümleler

Example 2:

// Golang program to demonstrate the
// example of strings.ToLowerSpecial() Function

package main

import (
	"fmt"
	"strings"
	"unicode"
)

func main() {
	fmt.Println(strings.ToLowerSpecial(unicode.TurkishCase, "Hello, world!"))
	fmt.Println(strings.ToLowerSpecial(unicode.TurkishCase, "(Hello, world!) İyi Cümleler"))
}

Output:

hello, world!
(hello, world!) iyi cümleler

Golang strings Package Functions »





Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.