Home »
Golang »
Golang Reference
Golang unicode.IsLower() Function with Examples
Golang | unicode.IsLower() Function: Here, we are going to learn about the IsLower() function of the unicode package with its usages, syntax, and examples.
Submitted by IncludeHelp, on September 17, 2021
unicode.IsLower()
The IsLower() function is an inbuilt function of the unicode package which is used to check whether the given rune r is a lower case letter.
It accepts one parameter (r rune) and returns true if rune r is a lowercase letter; false, otherwise.
Syntax
func IsLower(r rune) bool
Parameters
- r : Rune type value to be checked whether it is a lowercase letter or not.
Return Value
The return type of the unicode.IsLower() function is a bool, it returns true if rune r is a lowercase letter; false, otherwise.
Example 1
// Golang program to demonstrate the
// example of unicode.IsLower() Function
package main
import (
"fmt"
"unicode"
)
func main() {
fmt.Println("unicode.IsLower('a'):",
unicode.IsLower('a'))
fmt.Println("unicode.IsLower('r'):",
unicode.IsLower('r'))
fmt.Println("unicode.IsLower('A'):",
unicode.IsLower('A'))
fmt.Println("unicode.IsLower('R'):",
unicode.IsLower('R'))
fmt.Println("unicode.IsLower('☺')",
unicode.IsLower('☺'))
fmt.Println("unicode.IsLower('🙈'):",
unicode.IsLower('🙈'))
fmt.Println("unicode.IsLower('!'):",
unicode.IsLower('!'))
}
Output:
unicode.IsLower('a'): true
unicode.IsLower('r'): true
unicode.IsLower('A'): false
unicode.IsLower('R'): false
unicode.IsLower('☺') false
unicode.IsLower('🙈'): false
unicode.IsLower('!'): false
Example 2
// Golang program to demonstrate the
// example of unicode.IsLower() Function
package main
import (
"fmt"
"unicode"
)
func main() {
var r rune
var result bool
r = 'r'
result = unicode.IsLower(r)
if result == true {
fmt.Printf("%c is a lowercase character.\n", r)
} else {
fmt.Printf("%c is not a lowercase character.\n", r)
}
r = 'x'
result = unicode.IsLower(r)
if result == true {
fmt.Printf("%c is a lowercase character.\n", r)
} else {
fmt.Printf("%c is not a lowercase character.\n", r)
}
r = 'Q'
result = unicode.IsLower(r)
if result == true {
fmt.Printf("%c is a lowercase character.\n", r)
} else {
fmt.Printf("%c is not a lowercase character.\n", r)
}
r = 'ā'
result = unicode.IsLower(r)
if result == true {
fmt.Printf("%c is a lowercase character.\n", r)
} else {
fmt.Printf("%c is not a lowercase character.\n", r)
}
r = 'Ɐ'
result = unicode.IsLower(r)
if result == true {
fmt.Printf("%c is a lowercase character.\n", r)
} else {
fmt.Printf("%c is not a lowercase character.\n", r)
}
}
Output:
r is a lowercase character.
x is a lowercase character.
Q is not a lowercase character.
ā is a lowercase character.
Ɐ is not a lowercase character.
Golang unicode Package »