morestrings

package
v3.0.0-...-c77a060 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2019 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func JoinWithSpecialLast

func JoinWithSpecialLast(sep string, fin string, strs []string) string

JoinWithSpecialLast joins multiple strings together with a separator, except the last two, which are seperated by a different seperator.

Example (Long)
package main

import (
	"fmt"

	"github.com/BytemarkHosting/bytemark-client/lib/output/morestrings"
)

func main() {
	strs := []string{
		"hi", "hello", "welcome", "good evening",
	}
	fmt.Print(morestrings.JoinWithSpecialLast(", ", " and ", strs))

}
Output:

hi, hello, welcome and good evening
Example (OneString)
package main

import (
	"fmt"

	"github.com/BytemarkHosting/bytemark-client/lib/output/morestrings"
)

func main() {
	strs := []string{
		"hi",
	}
	fmt.Print(morestrings.JoinWithSpecialLast(", ", " and ", strs))

}
Output:

hi
Example (ThreeStrings)
package main

import (
	"fmt"

	"github.com/BytemarkHosting/bytemark-client/lib/output/morestrings"
)

func main() {
	strs := []string{
		"hi", "hello", "welcome",
	}
	fmt.Print(morestrings.JoinWithSpecialLast(", ", " and ", strs))

}
Output:

hi, hello and welcome
Example (TwoStrings)
package main

import (
	"fmt"

	"github.com/BytemarkHosting/bytemark-client/lib/output/morestrings"
)

func main() {
	strs := []string{
		"hi", "hello",
	}
	fmt.Print(morestrings.JoinWithSpecialLast(", ", " and ", strs))

}
Output:

hi and hello

Types

This section is empty.

Jump to

Keyboard shortcuts

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