Golang unicode.IsPunct() function example

package unicode

Golang unicode.IsPunct() function usage example.

 package main

 import (
 "fmt"
 "unicode"
 )

 func main() {

 punctuation := unicode.IsPunct('A')
 fmt.Println("A is a punctuation ? : ", punctuation)

 punctuation = unicode.IsPunct('.')
 fmt.Println(". is a punctuation ? : ", punctuation)

 }

Output :

A is a punctuation ? : false

. is a punctuation ? : true

SEE ALSO : https://www.socketloop.com/tutorials/golang-removes-punctuation-or-defined-delimiter-from-the-user-s-input

References :

https://www.socketloop.com/tutorials/golang-removes-punctuation-or-defined-delimiter-from-the-user-s-input

http://golang.org/pkg/unicode/#IsPunct

Advertisement