Skip to content

WqyJh/go-fstring

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-fstring GoDoc

The fstring package in Go provides a simple yet powerful way to interpolate strings, inspired by Python's f-string syntax.

Usage

Import the go-fstring package into your Go file:

import "github.com/WqyJh/go-fstring"

You can then use the Format function to interpolate strings. The Format function takes a template string and a map of values to interpolate into the template:

template := "Hello, {name}! You have {count} unread messages."
values := map[string]any{"name": "Alice", "count": 10}
result, err := fstring.Format(template, values)
if err != nil {
    // handle error
}
fmt.Println(result) // Output: Hello, Alice! You have 10 unread messages.

License

Released under the MIT License.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages