Skip to content

weblfe/varparse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

a var parse go lib

intro

A parse dynamic variable templates lib

install

require go >=1.18

go get github.com/weblfe/varparse

example

package main

import (
	"fmt"
	"github.com/weblfe/varparse"
)

func main() {
		var p = varparse.NewParser[string, any]()
		p.Assign("en", varparse.NewValue("hello,Go"))
		p.Assign("cn", varparse.NewValue("你好Go"))
		p.Assign("bool", varparse.NewValue(true))
		executor := varparse.NewExtractor("${","}")
		// default:=varparse.ExtractorOf()
		err := executor.Compile()
		if err!=nil {
				panic(err)
        }
		content := p.Parse(`${en},${cn} this a lib for var parse! Yes! ${bool}`, executor.Extract)		
		fmt.Println(content)
}

tool sites

regex tool site

development dependent on

testify

license (MIT)

About

var parse lib

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages