adventofcode/2019/day25/util.go
2020-11-06 15:04:08 -06:00

34 lines
630 B
Go

package main
import (
"strings"
termboxUtil "github.com/br0xen/termbox-util"
"github.com/nsf/termbox-go"
)
// Some characters for display
const (
ChUpKeyValue = '↑'
ChRightKeyValue = '→'
ChDownKeyValue = '↓'
ChLeftKeyValue = '←'
ChEnterKeyValue = '⏎'
ChCursor = '┇'
)
func DrawString(v string, x, y int, fg, bg termbox.Attribute) (int, int) {
termboxUtil.DrawStringAtPoint(v, x, y, fg, bg)
return (x + len(v)), (y + 1)
}
func FilterStrings(h []string, n string) []string {
var ret []string
for _, v := range h {
if strings.HasPrefix(v, n) {
ret = append(ret, v)
}
}
return ret
}