代码拉取完成,页面将自动刷新
props 是一个用于解析 properties 配置文件的库,可以应用于所有的 GoLang 应用程序中。
$ go get -u github.com/FishGoddess/props
package main
import (
"fmt"
"github.com/FishGoddess/props"
)
func main() {
// Load properties from a file.
properties, err := props.LoadFile("load.properties")
if err != nil {
panic(err)
}
// Get one key from properties and covert it into a integer.
fmt.Println(properties.Get("key1"))
fmt.Println(properties.Get("key1").Int())
// List all entries in properties.
// Returns false if you want to continue listing.
properties.List(func(key string, value props.Value) (finished bool) {
fmt.Println(key, value)
return false
})
// Use StoreFile to store a props to a file.
// What's more, we provide StoreMap and StoreWriter to store a props to map and writer.
err = props.StoreFile(properties, "store.properties")
if err != nil {
panic(err)
}
}
如果您觉得 props 缺少您需要的功能,请不要犹豫,马上参与进来,发起一个 issue。
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。