dictyBase/modware-annotation

View on GitHub
internal/collection/collection.go

Summary

Maintainability
A
0 mins
Test Coverage
package collection

// IncludeString determines whether the given string
// string is included in the string slice.
func IncludeString(a []string, s string) bool {
    for _, v := range a {
        if v == s {
            return true
        }
    }

    return false
}

// RemoveStringItems removes elements from a that are present in
// items.
func RemoveStringItems(a []string, items ...string) []string {
    var str []string
    for _, v := range a {
        if !IncludeString(items, v) {
            str = append(str, v)
        }
    }

    return str
}