stringutil

package
Version: v4.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAllExceptLastElement

func GetAllExceptLastElement(str string, separator string) string

GetAllExceptLastElement returns all elements except the last one of a "separator-separated" string

func GetFilePath

func GetFilePath(pathOrContent string) (string, bool, error)

GetFilePath takes in argument a string which can be a path to a file or the content of a file (some config values can be either a path or a content) If the argument is a file path, this function returns immediately this path value, and a boolean set to true meaning the argument was a path. If the argument is not a path, a new file will be created, the argument will be written in this file, the function will return the path to this new file, and a boolean value set to false meaning the argument wasn't a path

func GetLastElement

func GetLastElement(str string, separator string) string

GetLastElement returns the last element of a "separator-separated" string

func Truncate

func Truncate(str string, maxLength int) string

Truncate truncates a string if longer than defined max length The defined max length must be > 3 otherwise no truncation will be done. The returned string length is "max length" and ends with "..."

func UniqueTimestampedName

func UniqueTimestampedName(prefix string, suffix string) string

UniqueTimestampedName generates a time-stamped name for temporary file or directory by instance

Types

This section is empty.

Source Files

Jump to

Keyboard shortcuts

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