user_agent
user_agent copied to clipboard
Provide separate methods for getting OS version and name
It will be nice to have built-in methods for getting OS version and name, rather then split it manually.
UPD. Maybe something like this will be enough
// Returns a string containing the name of the Operating System.
func (p *UserAgent) OSName() string {
sp := strings.SplitN(p.os, " ", -1)
sp = sp[:len(sp)-1]
return strings.Join(sp, " ")
}
// Returns a string containing the version of the Operating System.
func (p *UserAgent) OSVersion() string {
sp := strings.SplitN(p.os, " ", -1)
return sp[len(sp)-1]
}