Go » Check if a string is an integer Just try to convert it with Atoi: if num, err := strconv.Atoi(str); err == nil { // ... }