kasane

package module
v0.0.0-...-d7af4a4 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2023 License: MIT Imports: 3 Imported by: 0

README

Go Reference

kasane

String overlay library for Go

Usage

base := ".......\n.......\n.......\n.......\n......."
s := "xxx\nyyy\nzzz"

out := kasane.OverlayString(base, s, 1, 3)
fmt.Println(out)

// Output:
// .......
// ...xxx.
// ...yyy.
// ...zzz.
// .......

License

MIT

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func OverlayString

func OverlayString(base, s string, top, left int, opts ...Option) string

OverlayString returns a string with the s string overlaid on the base string.

Example
base := ".......\n.......\n.......\n.......\n......."
s := "xxx\nyyy\nzzz"

out := OverlayString(base, s, 1, 3)
fmt.Println(out)
Output:

.......
...xxx.
...yyy.
...zzz.
.......

Types

type Option

type Option func(*k)

func WithPadding

func WithPadding(w int) Option

WithPadding sets the padding width. Lines shorter than w are processed with spaces appended.

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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