tr

package
v0.0.0-...-f022186 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package tr is similar to the Unix tr program. Originally based on the code in Software Tools by Kernighan and Plauger. Currently it is byte based - it does not handle unicode.

Index

Constants

This section is empty.

Variables

View Source
var EmptySet = Set("")

Functions

func Replace

func Replace(src string, from Set, to Set) string

Replace translates, squeezes, or deletes characters from the src string. If the first character of from is '^' then the from set is complemented. Ranges are specified with '-' between to characters. If the to set is empty, then characters in the from set are deleted. If the to set is shorter than the from set, then the last character in the to set is repeated to make the sets the same length, and this repeated character is never put more than once in a row in the output.

Types

type Set

type Set string

func New

func New(s string) Set

Jump to

Keyboard shortcuts

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