https://github.com/parithiban/stringcases
Golang string package to convert to various string cases
https://github.com/parithiban/stringcases
camelcase case-converter golang kebabcase pascalcase snakecase strings
Last synced: 19 days ago
JSON representation
Golang string package to convert to various string cases
- Host: GitHub
- URL: https://github.com/parithiban/stringcases
- Owner: parithiban
- License: mit
- Created: 2020-04-01T13:50:44.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-04-10T14:35:32.000Z (almost 6 years ago)
- Last Synced: 2024-09-23T09:13:42.093Z (over 1 year ago)
- Topics: camelcase, case-converter, golang, kebabcase, pascalcase, snakecase, strings
- Language: Go
- Homepage:
- Size: 18.6 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# stringcases
[](https://pkg.go.dev/github.com/parithiban/stringcases)
[](https://travis-ci.org/parithiban/stringcases)
[](https://codecov.io/github/parithiban/stringcases?branch=master)
[](https://GitHub.com/parithiban/stringcases/graphs/contributors/)

This is a string package written in go which is used to convert the strings to different case styles. The commonly used strategies are: camel case, pascal case, snake case, and kebab case.
## Installation
This requires Go version 1.11 or later.
> go get -u github.com/parithiban/stringcases
## Usage
The following are some of the methods that can be used from the package.
```code
ConvertToSnake Convert a string from any format to snake_case.
ConvertToKebab Convert a string from any format to kebab-case.
ConvertToPascal Convert a string from any format to PascalCase.
ConvertToCamel Convert a string from any format to camelCase.
```
## Example
```code
ConvertToSnake("ConvertToSnakeCase") => convert_to_snake_case
ConvertToKebab("convert_to_kebab_case") => convert-to-kebab-case.
ConvertToPascal("convert-to-pascal-case") => ConvertToPascalCase.
ConvertToCamel("convert to camel case") => convertToCamelCase.
```