Golang strconv.IsPrint() function is “used to check whether a given rune is defined as printable.”
The print characters include the following:
- letters
- numerals
- punctuation
- symbols
- ASCII space
Syntax
func IsPrint(r rune) bool
Parameters
r: This is the rune value to be checked.
Return value
The strconv.IsPrint() function returns a boolean true if the given rune is defined as a printable. Otherwise, false.
Example 1: How does IsPrint() function work?
package main
import (
"fmt"
"strconv"
)
func main() {
fmt.Println(strconv.IsPrint('x'))
fmt.Println(strconv.IsPrint('?'))
}
Output
true
true
Example 2: How to Use strconv.IsPrint() function
package main
import (
"fmt"
"strconv"
)
func main() {
data := 'k'
res1 := strconv.IsPrint(data)
fmt.Printf("Result 1: %v", res1)
val := '\003'
res3 := strconv.IsPrint(val)
fmt.Printf("\nResult 3: %v", res3)
}
Output
Result 1: true
Result 3: false
That’s it.

Krunal Lathiya is a seasoned Computer Science expert with over eight years in the tech industry. He boasts deep knowledge in Data Science and Machine Learning. Versed in Python, JavaScript, PHP, R, and Golang. Skilled in frameworks like Angular and React and platforms such as Node.js. His expertise spans both front-end and back-end development. His proficiency in the Python language stands as a testament to his versatility and commitment to the craft.