Documentation
¶
Overview ¶
Example (TabPrint) ¶
tp := NewTabPrinter(8)
for i := range 33 {
tp.Print(i)
}
tp.Println()
for _, v := range []string{"one", "two", "three", "four", "five", "six"} {
tp.Print(v)
}
tp.Println()
Output: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 one two three four five six
Example (TabPrintTwoFullLines) ¶
tp := NewTabPrinter(4)
for _, v := range []string{"one", "two", "three", "four", "five", "six", "seven", "eight"} {
tp.Print(v)
}
tp.Println()
Output: one two three four five six seven eight
Example (TabPrintWider) ¶
tp := NewTabPrinter(2)
tp.TabWidth(10)
for _, v := range []string{"one", "two", "three", "four", "five", "six", "seven", "eight", "larger", "largest", "even more", "enough"} {
tp.Print(v)
}
tp.Println()
Output: one two three four five six seven eight larger largest even more enough
Index ¶
- Constants
- func Bool2Integer[T Integer](b bool) T
- func DumpHex[T []byte | *bytes.Buffer](buf T) (dump string)
- func Format(i any) string
- func FormatInteger[T Integer](data T) string
- func FormatIntegerHex[T Integer](data T) string
- func FormatIntegerHex0x[T Integer](data T) string
- func Integer2Bool[T Integer](value T) bool
- func IsASCIIDigit(s string) bool
- func IsIncludeLine(s string) bool
- func Print(i any)
- func PrintTo(out io.Writer, i any, nl bool)
- func ValueIsBytesType(v reflect.Value) bool
- type Complex
- type Float
- type Integer
- type Ordered
- type Pretty
- type Signed
- type TabPrinter
- type Unsigned
Examples ¶
Constants ¶
View Source
const ( DEFAULT_INDENT = " " DEFAULT_NIL = "nil" )
Variables ¶
This section is empty.
Functions ¶
func Bool2Integer ¶
func FormatInteger ¶
func FormatIntegerHex ¶
func FormatIntegerHex0x ¶
func Integer2Bool ¶
func IsASCIIDigit ¶
func IsIncludeLine ¶
func ValueIsBytesType ¶
Types ¶
type Complex ¶
type Complex interface {
~complex64 | ~complex128
}
type Pretty ¶
type TabPrinter ¶
type TabPrinter struct {
// contains filtered or unexported fields
}
A TabPrinter is an object that allows printing tab-aligned words on multiple lines, up to a maximum number per line
func NewTabPrinter ¶
func NewTabPrinter(max int) *TabPrinter
create a TabPrinter max specifies the maximum number of 'words' per line
func (*TabPrinter) Print ¶
func (tp *TabPrinter) Print(arg any)
print a 'word' when the maximum number of words per lines is reached, this will print the formatted line
func (*TabPrinter) Println ¶
func (tp *TabPrinter) Println()
print current line terminate current line and print - call this after all words have been printed
func (*TabPrinter) TabWidth ¶
func (tp *TabPrinter) TabWidth(n int)
update tab width (minimal space between words)
Click to show internal directories.
Click to hide internal directories.