From 3e1f88b37bc94d9658c156216dfa720b5251ed14 Mon Sep 17 00:00:00 2001 From: Eric Coissac Date: Fri, 17 Feb 2023 23:10:43 +0100 Subject: [PATCH] adds the subspc function to the gval language --- pkg/obieval/language.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/obieval/language.go b/pkg/obieval/language.go index 5aa78c2..74b4784 100644 --- a/pkg/obieval/language.go +++ b/pkg/obieval/language.go @@ -3,6 +3,7 @@ package obieval import ( "fmt" "log" + "strings" "git.metabarcoding.org/lecasofts/go/obitools/pkg/goutils" "github.com/PaesslerAG/gval" @@ -146,6 +147,10 @@ var OBILang = gval.NewLanguage( text := fmt.Sprintf(args[0].(string), args[1:]...) return text, nil }), + gval.Function("subspc", func(args ...interface{}) (interface{}, error) { + text := strings.ReplaceAll(args[0].(string), " ", "_") + return text, nil + }), gval.Function("int", func(args ...interface{}) (interface{}, error) { val, err := goutils.InterfaceToInt(args[0])