package main
import (
"fmt"
"net"
)
func main() {
str := "11.22.33.44"
if net.ParseIP(str) != nil {
fmt.Println("Valid")
} else {
fmt.Println("InValid")
}
}
Output
Valid
package main
import (
"fmt"
"net"
)
func main() {
str := "11.22.33.44"
if net.ParseIP(str) != nil {
fmt.Println("Valid")
} else {
fmt.Println("InValid")
}
}
Valid