Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/lawrsp/stringstyles

convert string styles with golang
https://github.com/lawrsp/stringstyles

camel golang kebab snake

Last synced: about 1 month ago
JSON representation

convert string styles with golang

Awesome Lists containing this project

README

        

# stringstyles

## install

```bash
go get -u "github/lawrsp/stringstyles"
```

## Usage

### CamelCase

```golang
import "github.com/lawrsp/stringstyles"

input := "the_quick_brown_fox_jumps_over_the_lazy_dog"
output := stringstyles.CamelCase(input)

// got:
// theQuickBrownFoxJumpsOverTheLazyDog
```

### SnakeCase

```golang
import "github.com/lawrsp/stringstyles"

input := "TheQuickBrownFoxJumpsOverTheLazyDog"
output := stringstyles.SnakeCase(input)

// got:
// the_quick_brown_fox_jumps_over_the_lazy_dog
```

### KebabCase

```golang
import "github.com/lawrsp/stringstyles"

input := "TheQuickBrownFoxJumpsOverTheLazyDog"
output := stringstyles.SnakeCase(input)

// got:
// the-quick-brown-fox-jumps-over-the-lazy-dog
```

### StudlyCaps

```golang
import "github.com/lawrsp/stringstyles"

input := "TheQuickBrownFoxJumpsOverTheLazyDog"
random := 31283726224234348
output := stringstyles.StudlyCaps(input, random)

// got:
// ThEquICkbROwNFoXJumPSOVErTHElazyDOg
```