×

Golang Tutorial

Golang Reference

Golang Programs

Golang Practice

Golang Miscellaneous

Golang strings.ToUpperSpecial() Function with Examples

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

strings.ToUpperSpecial()

The ToUpperSpecial() 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 upper 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 upper case based on the given SpecialCase type.

Syntax

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

Parameters

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

Return Value

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

Example 1

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

package main

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

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

Output:

SELAM DÜNYA
İYİ CÜMLELER

Example 2

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

package main

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

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

Output:

HELLO, WORLD!
(HELLO, WORLD!) İYİ CÜMLELER

Golang strings Package Functions »




Comments and Discussions!

Load comments ↻





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