util

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BlockIndent

func BlockIndent(txt string, prefixes []string, indents []string) string

BlockIndent indents each line in a block of text.

Line format is: <prefix><indent><text>

Args: - txt -- the block of text to indent - prefixes -- strings that appears before the indent on each line.

  • if length=0, prefix is empty
  • if length=1, same prefix is used on every line
  • if length=2, 1st line prefix and all other line prefix
  • any other length is invalid

- indents -- indent strings after prefix but before text.

  • if length=0, indent is empty
  • if length=1, same indent is used on every line
  • if length=2, 1st line indent and all other line indent
  • any other length is invalid

Returns: - if error, string with format: ERROR: <error message> - indented string if no errors

func Capitalize

func Capitalize(s string) string

Capitalize returns string with its first letter in uppercase.

func ValueIfTrue

func ValueIfTrue(boolTest bool, trueValue, falseValue string) string

ValueIfTrue converts a boolean into strings for true and false. - if boolTest is true, return trueValue else return falseValue

Types

This section is empty.

Jump to

Keyboard shortcuts

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