mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2025-06-16 00:56:09 +00:00
Make some API changes (currently broken)
This commit is contained in:
@ -2,9 +2,13 @@ package util
|
||||
|
||||
// These are misc. utility functions that didn't really fit anywhere else
|
||||
|
||||
import "runtime"
|
||||
import "sync"
|
||||
import "time"
|
||||
import (
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
// A wrapper around runtime.Gosched() so it doesn't need to be imported elsewhere.
|
||||
func Yield() {
|
||||
@ -91,3 +95,16 @@ func Difference(a, b []string) []string {
|
||||
}
|
||||
return ab
|
||||
}
|
||||
|
||||
// DecodeCoordString decodes a string representing coordinates in [1 2 3] format
|
||||
// and returns a []byte.
|
||||
func DecodeCoordString(in string) (out []uint64) {
|
||||
s := strings.Trim(in, "[]")
|
||||
t := strings.Split(s, " ")
|
||||
for _, a := range t {
|
||||
if u, err := strconv.ParseUint(a, 0, 64); err == nil {
|
||||
out = append(out, u)
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
Reference in New Issue
Block a user