strings

package
v0.0.0-...-862fecd Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2021 License: MIT Imports: 3 Imported by: 0

README

strings

High-performance string management and manipulation capabilities.

Documentation

Overview

Strings provides high-performance string management and manipulation capabilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JoinBytes

func JoinBytes(separator []byte, byteArray ...[]byte) []byte

JoinStrings joins many []byte strings together separated by the specified separator.

func JoinStrings

func JoinStrings(separator string, stringArray ...string) string

JoinStrings joins many strings together separated by the specified separator.

func JoinStringsReversed

func JoinStringsReversed(separator string, stringArray ...string) string

JoinStringsReversed joins many strings together backwards separated by the specified separator.

func MergeBytes

func MergeBytes(byteArray ...[]byte) []byte

MergeBytes merges an array of []byte strings into one []byte.

Example

one := []byte("Hello")
two := []byte(" ")
three := []byte("Stretchr!")

// merge the bytes
mergedBytes := strings.MergeBytes(one, two, three)

log.Print(mergedBytes)
// prints "Hello Stretchr!"

func MergeStrings

func MergeStrings(stringArray ...string) string

MergeStrings merges many strings together.

func MergeStringsReversed

func MergeStringsReversed(stringArray ...string) string

MergeStringsReversed merges many strings together backwards.

func Parse

func Parse(s string) interface{}

Parse tries to create a native object from the given string, or just returns the string if nothing takes.

Values wrapped in "quotes" or 'single quotes' will always be treated as a string, but the quotes will be removed.

This method knows about all number types, and will always look for the smallest type to fit the number. It also handles the boolean literals 'true' and 'false'.

An empty string ("") will return nil.

func SplitBy

func SplitBy(s string, decider func(r rune) bool) []string

SplitBy splits a string to segments based on the return of the decider function.

func SplitByCamelCase

func SplitByCamelCase(s string) []string

SplitByCamelCase splits the string up by each capital character.

Types

This section is empty.

Jump to

Keyboard shortcuts

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