⬗ (Osu! Background Manager) A little utility to replace, retrieve or remove backgrounds for every beatmap in your osu! folder ⬖
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
577 B

package manager
import "strings"
// Search tries to locate instances of beatmaps with the provided name (or part of the name);
// returns a slice of found beatmaps and a number of searched beatmaps
func Search(beatmaps []Beatmap, name string) ([]Beatmap, uint64) {
var instances []Beatmap
var searched uint64 = 0
// to make the search case-insensitive
name = strings.ToLower(name)
for _, beatmap := range beatmaps {
if strings.Contains(strings.ToLower(beatmap.Name), name) {
instances = append(instances, beatmap)
}
searched++
}
return instances, searched
}