GithubHelp home page GithubHelp logo

str-case's Introduction

str_case

a Go library for string case manipulation. it is always uses Builder.Write methods to efficiently build a string and minimizes memory copying.

Install

go get github.com/mohprilaksono/str-case

Example

import str_case "github.com/mohprilaksono/str-case"

str_case.Apa("Thomas And Friends") //Thomas and Friends
str_case.Sponge("HTML is not a programming language") // hTmL Is nOt A ProGraMmINg LanGuAgE

Usage

Ada

Converts the given string to Ada_Case.

import str_case "github.com/mohprilaksono/str-case"

var value = str_case.Ada("helloWorld") 

// Hello_World

Apa

Converts the given string to Title Case, following the APA Guidelines.

import str_case "github.com/mohprilaksono/str-case"

var value = str_case.Apa("Thomas And Friends") 

// Thomas and Friends

Camel

Converts the given string to camelCase.

import str_case "github.com/mohprilaksono/str-case"

var value = str_case.Camel("hello_world") 

// helloWorld

Cobol

Converts the given string to COBOL-CASE.

import str_case "github.com/mohprilaksono/str-case"

var value = str_case.Cobol("helloWorld") 

// HELLO-WORLD

Kebab

Converts the given string to kebab-case.

import str_case "github.com/mohprilaksono/str-case"

var value = str_case.Kebab("helloWorld") 

// hello-world

LcFirst

Converts the given string with the first-character lowercased.

import str_case "github.com/mohprilaksono/str-case"

var value = str_case.LcFirst("HelloWorld") 

// helloWorld

Macro

Converts the given string to MACRO_CASE.

import str_case "github.com/mohprilaksono/str-case"

var value = str_case.Macro("helloWorld") 

// HELLO_WORLD

Snake

Converts the given string to snake_case.

import str_case "github.com/mohprilaksono/str-case"

var value = str_case.Snake("helloWorld") 

// hello_world

Sponge

Converts the given string to sPoNGeCAse, it is usually used for creating a "Mocking SpongeBob" meme.

import str_case "github.com/mohprilaksono/str-case"

var value = str_case.Sponge("HTML is not a programming language") 

// hTmL Is nOt A ProGraMmINg LanGuAgE

Studly

Converts the given string to StudlyCase.

import str_case "github.com/mohprilaksono/str-case"

var value = str_case.Studly("hello_world") 

// HelloWorld

Swap

Swap the case of the given string.

import str_case "github.com/mohprilaksono/str-case"

var value = str_case.Swap("HelloWorlD") 

// hELLOwORLd

Title

Converts the given string to Title Case.

import str_case "github.com/mohprilaksono/str-case"

var value = str_case.Title("hello world") 

// Hello World

Train

Converts the given string to Train-Case.

import str_case "github.com/mohprilaksono/str-case"

var value = str_case.Train("helloWorld") 

// Hello-World

UcFirst

Converts the given string with the first-character uppercased.

import str_case "github.com/mohprilaksono/str-case"

var value = str_case.UcFirst("helloWorld") 

// HelloWorld

Dependencies

Build dependencies

  • none

Test dependencies

  • github.com/stretchr/testify

Running Tests

go test -v

str-case's People

Contributors

mohprilaksono avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.