ADVERTISEMENT
ADVERTISEMENT

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

Parameter(s):

  • 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 »


ADVERTISEMENT



ADVERTISEMENT



Comments and Discussions


ADVERTISEMENT

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.