stringutil

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2018 License: MIT Imports: 2 Imported by: 2

README

Go string utilities

GoDoc Go Report Card

This package provides the helper functions for manipulating strings in Go.

SplitToLines

func SplitToLines(str string, lsz int) (res []string)

SplitToLines splits specified string to lines, no longer than specified number of characters. If a single word doesn't fit the line, it won't be split.

Example input:

Lorem ipsum dolor sit amet, consectetur
adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut
enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
commodo consequat. Duis aute irure dolor
in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

Example output for lines, no longer than 40 characters:

Lorem ipsum dolor sit amet, consectetur
adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna
aliqua. Ut
enim ad minim veniam, quis nostrud
exercitation ullamco laboris nisi ut
aliquip ex ea
commodo consequat. Duis aute irure dolor
in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur.

SnakeCaps

func SnakeCaps(id string) string

SnakeCaps transforms specified camel case identifier to an upper case identifier with the words, separated by an underscore.

Input Output
GeckoOrca GECKO_ORCA
geckoORCA GECKO_ORCA
g3ckoOrca G3CKO_ORCA
PumaG3CKOOrca PUMA_G3CKO_ORCA

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SnakeCaps

func SnakeCaps(id string) string

SnakeCaps transforms specified camel case identifier to an upper case identifier with the words, separated by an underscore.

func SplitToLines

func SplitToLines(str string, lsz int) (res []string)

SplitToLines splits specified string to lines, no longer than specified number of characters. If a single word doesn't fit the line, it won't be split.

Types

This section is empty.

Jump to

Keyboard shortcuts

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