user_agent icon indicating copy to clipboard operation
user_agent copied to clipboard

Provide separate methods for getting OS version and name

Open trntv opened this issue 9 years ago • 0 comments

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]
}

trntv avatar Oct 13 '16 07:10 trntv