strs

package
v0.0.0-...-ded95ce Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2022 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Overview

Package strs contains string-related utility funcs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CutPrefix

func CutPrefix(s, prefix string) (after string, found bool)

CutPrefix returns s without the provided leading prefix string and reports whether it found the prefix. If s doesn't start with prefix, CutPrefix returns s, false. If prefix is the empty string, CutPrefix returns s, true.

TODO: remove this once Go 1.20 is out with it. See https://github.com/tailscale/tailscale/issues/5309

func CutSuffix

func CutSuffix(s, suffix string) (before string, found bool)

CutSuffix returns s without the provided ending suffix string and reports whether it found the suffix. If s doesn't end with suffix, CutSuffix returns s, false. If suffix is the empty string, CutSuffix returns s, true.

See https://github.com/tailscale/tailscale/issues/5309 TODO: remove this once Go 1.20 is out with it.

Types

This section is empty.

Jump to

Keyboard shortcuts

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