stringext

package module
v0.0.0-...-6ed2a4d Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2016 License: MIT Imports: 6 Imported by: 9

README

GoDoc Build Status

stringext

Extension functions to Go's string package

-- import "."

Package stringext adds extra power to the strings package with helper functions

Usage

func AsComment
func AsComment(c string) string

AsComment formats the given string as if it is a Go Comment, breaks lines every 78 lines

func Contains
func Contains(n string, r []string) bool

Contains checks if the given string is in given string slice

func Depunct
func Depunct(ident string, initialCap bool) string

Depunct splits the given string with special chars and operates on them one by one

func DepunctWithInitialLower
func DepunctWithInitialLower(ident string) string

DepunctWithInitialLower does special operations to the given string, while operating lowercases the special words

func DepunctWithInitialUpper
func DepunctWithInitialUpper(ident string) string

DepunctWithInitialUpper does special operations to the given string, while operating uppercases the special words

func Equal
func Equal(a, b string) bool

Equal check if given two strings are same, used in templates

func JSONTag
func JSONTag(n string, required bool) string

JSONTag generates json tag for given string, it is using the javascript concepts

eg: ID ->

	becomes "id" if it is at the beginning
 	or
 becomes "Id" if it is in the middle of the string
func Normalize
func Normalize(s string) string

Normalize removes non a-z characters and uppercases the following character, all characters followed by it will be lowercased if the word is one the acronymsi

func Pointerize
func Pointerize(ident string) string

Pointerize returns the first character of a given string as lowercased, this method is intened to use as a function receiver generator

func ToFieldName
func ToFieldName(u string) string

ToFieldName handles field names, if the given string is one of the acronymsi it is lowercasing it

given "URL" as parameter converted to "url" given "ProfileURL" as parameter converted to "profile_url" given "Profile" as parameter converted to "profile" given "ProfileName" as parameter converted to "profile_name"

func ToLowerFirst
func ToLowerFirst(ident string) string

ToLowerFirst lowers the first character of any given unicode char

func ToUpperFirst
func ToUpperFirst(ident string) string

ToUpperFirst converts the first character of any given unicode char to uppercase

Documentation

Overview

Package stringext adds extra power to the strings package with helper functions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsComment

func AsComment(c string) string

AsComment formats the given string as if it is a Go Comment, breaks lines every 78 lines

func Capitalize

func Capitalize(str string) string

Capitalize uppercases the first char of s and lowercases the rest.

func Contains

func Contains(n string, r []string) bool

Contains checks if the given string is in given string slice

func Depunct

func Depunct(ident string, initialCap bool) string

Depunct splits the given string with special chars and operates on them one by one

func DepunctWithInitialLower

func DepunctWithInitialLower(ident string) string

DepunctWithInitialLower does special operations to the given string, while operating lowercases the special words

func DepunctWithInitialUpper

func DepunctWithInitialUpper(ident string) string

DepunctWithInitialUpper does special operations to the given string, while operating uppercases the special words

func Equal

func Equal(a, b string) bool

Equal check if given two strings are same, used in templates

func JSONTag

func JSONTag(n string, required bool) string

JSONTag generates json tag for given string, it is using the javascript concepts

eg: ID ->

	becomes "id" if it is at the beginning
 	or
 becomes "Id" if it is in the middle of the string

func JSONTagWithIgnored

func JSONTagWithIgnored(n string, required bool, ignored bool, fieldType string, forceTags string) string

func Normalize

func Normalize(s string) string

Normalize removes non a-z characters and uppercases the following character, all characters followed by it will be lowercased if the word is one the acronymsi

func Pointerize

func Pointerize(ident string) string

Pointerize returns the first character of a given string as lowercased, this method is intened to use as a function receiver generator

func ToFieldName

func ToFieldName(u string) string

ToFieldName handles field names, if the given string is one of the `acronymsi` it is lowercasing it

given "URL" as parameter converted to "url" given "ProfileURL" as parameter converted to "profile_url" given "Profile" as parameter converted to "profile" given "ProfileName" as parameter converted to "profile_name"

func ToLowerFirst

func ToLowerFirst(ident string) string

ToLowerFirst lowers the first character of any given unicode char

func ToUpperFirst

func ToUpperFirst(ident string) string

ToUpperFirst converts the first character of any given unicode char to uppercase

Types

This section is empty.

Jump to

Keyboard shortcuts

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