xstrings

package
v0.0.0-...-ed9fe1d Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2018 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package xstrings provides extended utility functions for strings

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func SplitAndTrim

func SplitAndTrim(s string, sep string) []string

SplitAndTrim is like strings.Split but spaces in each of item are trimmed

func SplitAndTrimAsMap

func SplitAndTrimAsMap(s string, sep string) map[string]struct{}

SplitAndTrimAsMap is like SplitAndTrim but returns an map[string]bool where the map key is the string flagment included in

func ToSnakeCase

func ToSnakeCase(s string) string

ToSnakeCase converts the string to the one by snake case.

Example
fmt.Println(
	ToSnakeCase("FooBar"),
	ToSnakeCase("APIDoc"),
	ToSnakeCase("OK"),
	ToSnakeCase("IsOK"),
	ToSnakeCase("camelCase"),
)
Output:

foo_bar api_doc ok is_ok camel_case

Types

This section is empty.

Jump to

Keyboard shortcuts

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