properties

package module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 5, 2021 License: BSL-1.0 Imports: 5 Imported by: 0

README

properties

GoDoc

About

This package provides functions to read and write properties. It is published on https://github.com/vbsw/misc/properties.

Example

package main

import (
	"fmt"
	"github.com/vbsw/misc/properties"
)

func main() {
	props, err := properties.ReadFile("some/path/to/file")

	if err == nil {
		for propName, propValue := range props {
			fmt.Println(propName, propValue)
		}
	}
}

References

Documentation

Overview

Package properties provides functions to read/write properties.

Index

Constants

View Source
const (
	// Spaces enables spaces around the assignment operator.
	Spaces = 0
	// OpCollon enables collon as the assignment operator.
	OpCollon = 1
	// OpEqual enables equal sign as the assignment operator.
	OpEqual = 2
	// OpSpace enables space as the assignment operator.
	OpSpace = 3
)

Formatting options.

Variables

This section is empty.

Functions

func ReadBytes

func ReadBytes(bytes []byte) map[string]string

ReadBytes reads properties from byte array. Content of byte array must be in UTF-8.

func ReadFile

func ReadFile(path string) (map[string]string, error)

ReadFile reads properties from file. File must be in UTF-8.

func ToBytes

func ToBytes(propNames, propValues []string, formatting ...int) []byte

ToBytes converts properties to byte array.

func WriteFile

func WriteFile(path string, propNames, propValues []string) error

WriteFile writes properties to file.

Types

This section is empty.

Directories

Path Synopsis
linescanner module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL