Check If the Rune is a Space Character or not in Golang Last Updated : 27 Sep, 2019 Comments Improve Suggest changes Like Article Like Report Rune is a superset of ASCII or it is an alias of int32. It holds all the characters available in the world's writing system, including accents and other diacritical marks, control codes like tab and carriage return, and assigns each one a standard number. This standard number is known as a Unicode code point or rune in the Go language. You are allowed to check the given rune is a space character or not defined by the Unicode's White Space property, with the help of IsSymbol() function. This function returns true if the given rune is a space character, or return false if the given rune is not a space character. This function is defined under Unicode package, so for accessing this method you need to import the Unicode package in your program. Syntax: func IsSpace(r rune) bool The return type of this function is boolean. Let us discuss this concept with the help of given examples: Example 1: C // Go program to illustrate how to check // the given rune is a space character // or not package main import ( "fmt" "unicode" ) // Main function func main() { // Creating rune rune_1 := 'g' rune_2 := 'e' rune_3 := '\t' rune_4 := '\n' rune_5 := 'S' // Checking the given rune is // a space character or not // Using IsSpace () function res_1 := unicode.IsSpace(rune_1) res_2 := unicode.IsSpace(rune_2) res_3 := unicode.IsSpace(rune_3) res_4 := unicode.IsSpace(rune_4) res_5 := unicode.IsSpace(rune_5) // Displaying results fmt.Println(res_1) fmt.Println(res_2) fmt.Println(res_3) fmt.Println(res_4) fmt.Println(res_5) } Output: false false true true false Example 2: C // Go program to illustrate how to check // the given rune is a space character // or not package main import ( "fmt" "unicode" ) // Main function func main() { // Creating a slice of rune val := []rune{'g', '\f', '\v', '&', ' '} // Checking the given rune is // a space character or not // Using IsSpace () function for i := 0; i < len(val); i++ { if unicode.IsSpace(val[i]) == true { fmt.Println("It is a space character") } else { fmt.Println("It is not a space character") } } } Output: It is not a space character It is a space character It is a space character It is not a space character It is a space character Comment More infoAdvertise with us Next Article Check If the Rune is a Unicode Punctuation Character or not in Golang A ankita_saini Follow Improve Article Tags : Go Language Golang Similar Reads Check If the Rune is a Symbolic Character or not in Golang Rune is a superset of ASCII or it is an alias of int32. It holds all the characters available in the world's writing system, including accents and other diacritical marks, control codes like tab and carriage return, and assigns each one a standard number. This standard number is known as a Unicode c 1 min read Check If the Rune is a Unicode Punctuation Character or not in Golang Rune is a superset of ASCII or it is an alias of int32. It holds all the characters available in the world's writing system, including accents and other diacritical marks, control codes like tab and carriage return, and assigns each one a standard number. This standard number is known as a Unicode c 2 min read Check If the Rune is a Letter or not in Golang Rune is a superset of ASCII or it is an alias of int32. It holds all the characters available in the world's writing system, including accents and other diacritical marks, control codes like tab and carriage return, and assigns each one a standard number. This standard number is known as a Unicode c 2 min read Check If the Rune is a Decimal Digit or not in Golang Rune is a superset of ASCII or it is an alias of int32. It holds all the characters available in the world's writing system, including accents and other diacritical marks, control codes like tab and carriage return, and assigns each one a standard number. This standard number is known as a Unicode c 2 min read Check if the given characters is present in Golang String 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 strings, you are allowed to check the given characters present in the s 3 min read Check If the Rune is an Uppercase Letter or not in Golang Rune is a superset of ASCII or it is an alias of int32. It holds all the characters available in the world's writing system, including accents and other diacritical marks, control codes like tab and carriage return, and assigns each one a standard number. This standard number is known as a Unicode c 2 min read Like