slice

package
v0.124.1-alpha1 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Join

func Join(value any, sep string) string

Join concatenates the elements of its first argument to create a single string. The separator string sep is placed between elements in the resulting string.

Disclaimer: Use this function judiciously.

Example (Interfaces)
fmt.Println(Join([]interface{}{"a", "b", "c"}, ","))
Output:

a,b,c
Example (Ints)
fmt.Println(Join([]int{1, 2, 3}, ","))
Output:

1,2,3
Example (String)
fmt.Println(Join("hello", ","))
Output:

hello
Example (Strings)
fmt.Println(Join([]string{"a", "b", "c"}, ","))
Output:

a,b,c
Example (Struct)
type Person struct {
	Name string
}
fmt.Println(Join(Person{Name: "Someone Else"}, ","))
Output:

{Someone Else}

Types

This section is empty.

Jump to

Keyboard shortcuts

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