merger

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MergeSlices

func MergeSlices(slices ...[]string) []string

MergeSlices merges multiple slices of strings into a single slice. It skips any nil slices and handles empty slices gracefully.

Parameters:

  • slices: A variadic parameter that takes multiple slices of strings.

Returns:

  • A single slice of strings containing all the elements from the input slices, in the order they were provided.

Example:

// Merge multiple slices of strings
slice1 := []string{"a", "b"}
slice2 := []string{"c", "d"}
slice3 := []string{"e", "f"}

merged := MergeSlices(slice1, slice2, slice3)
// merged now contains: ["a", "b", "c", "d", "e", "f"]

// Merge slices with nil and empty slices
slice4 := []string{"g", "h"}
emptySlice := []string{}

merged = MergeSlices(nil, slice1, emptySlice, slice4)
// merged now contains: ["a", "b", "g", "h"]

Types

This section is empty.

Jump to

Keyboard shortcuts

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