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

https://github.com/ldez/samples-go-libs-string-cases

Comparison of Word Cases Manipulations Libraries
https://github.com/ldez/samples-go-libs-string-cases

camelcase go golang kebab-case kebabcase libraries pascal-case pascalcase snake-case snakecase string-casing string-manipulation string-manipulations

Last synced: about 2 months ago
JSON representation

Comparison of Word Cases Manipulations Libraries

Awesome Lists containing this project

README

        

## Results

| Lib | Snake | Kebab | Pascal Case | Camel Case |
|---------------------------------------------------------------------|---------------------|---------------------|---------------------|---------------------|
| **GooID** | - | - | - | - |
| [ettle/strcase](https://github.com/ettle/strcase) | goo_id | goo-id | GooId | gooId |
| [gobeam/stringy](https://github.com/gobeam/stringy) | Goo_ID | Goo-ID | GooID | |
| [stoewer/go-strcase](https://github.com/stoewer/go-strcase) | goo_id | goo-id | GooId | gooId |
| [iancoleman/strcase](https://github.com/iancoleman/strcase) | goo_id | goo-id | GooID | gooID |
| [pascaldekloe/name](https://github.com/pascaldekloe/name) | goo_ID | | GooID | gooID |
| [nikitaksv/strcase](https://github.com/nikitaksv/strcase) | goo_id | goo-id | GooId | gooId |
| [mantidtech/wordcase](https://github.com/mantidtech/wordcase) | goo_id | goo-id | GooID | gooID |
| [dc0d/caseconv](https://github.com/dc0d/caseconv) | goo_id | goo-id | GooId | gooId |
| [parithiban/stringcases](https://github.com/parithiban/stringcases) | goo_i_d | goo-i-d | GooID | gooID |
| **HTTPStatusCode** | - | - | - | - |
| [ettle/strcase](https://github.com/ettle/strcase) | http_status_code | http-status-code | HttpStatusCode | httpStatusCode |
| [gobeam/stringy](https://github.com/gobeam/stringy) | HTTPStatus_Code | HTTPStatus-Code | HTTPStatusCode | |
| [stoewer/go-strcase](https://github.com/stoewer/go-strcase) | http_status_code | http-status-code | HttpstatusCode | httpstatusCode |
| [iancoleman/strcase](https://github.com/iancoleman/strcase) | http_status_code | http-status-code | HTTPStatusCode | hTTPStatusCode |
| [pascaldekloe/name](https://github.com/pascaldekloe/name) | HTTP_status_code | | HTTPStatusCode | hTTPStatusCode |
| [nikitaksv/strcase](https://github.com/nikitaksv/strcase) | httpstatus_code | httpstatus-code | HttpstatusCode | httpstatusCode |
| [mantidtech/wordcase](https://github.com/mantidtech/wordcase) | http_status_code | http-status-code | HTTPStatusCode | httpStatusCode |
| [dc0d/caseconv](https://github.com/dc0d/caseconv) | http_status_code | http-status-code | HttpStatusCode | httpStatusCode |
| [parithiban/stringcases](https://github.com/parithiban/stringcases) | h_t_t_p_status_code | h-t-t-p-status-code | HTTPStatusCode | hTTPStatusCode |
| **FooBAR** | - | - | - | - |
| [ettle/strcase](https://github.com/ettle/strcase) | foo_bar | foo-bar | FooBar | fooBar |
| [gobeam/stringy](https://github.com/gobeam/stringy) | Foo_BAR | Foo-BAR | FooBAR | |
| [stoewer/go-strcase](https://github.com/stoewer/go-strcase) | foo_bar | foo-bar | FooBar | fooBar |
| [iancoleman/strcase](https://github.com/iancoleman/strcase) | foo_bar | foo-bar | FooBAR | fooBAR |
| [pascaldekloe/name](https://github.com/pascaldekloe/name) | foo_BAR | | FooBAR | fooBAR |
| [nikitaksv/strcase](https://github.com/nikitaksv/strcase) | foo_bar | foo-bar | FooBar | fooBar |
| [mantidtech/wordcase](https://github.com/mantidtech/wordcase) | foo_bar | foo-bar | FooBar | fooBar |
| [dc0d/caseconv](https://github.com/dc0d/caseconv) | foo_bar | foo-bar | FooBar | fooBar |
| [parithiban/stringcases](https://github.com/parithiban/stringcases) | foo_b_a_r | foo-b-a-r | FooBAR | fooBAR |
| **URL** | - | - | - | - |
| [ettle/strcase](https://github.com/ettle/strcase) | url | url | Url | url |
| [gobeam/stringy](https://github.com/gobeam/stringy) | URL | URL | URL | |
| [stoewer/go-strcase](https://github.com/stoewer/go-strcase) | url | url | Url | url |
| [iancoleman/strcase](https://github.com/iancoleman/strcase) | url | url | URL | uRL |
| [pascaldekloe/name](https://github.com/pascaldekloe/name) | URL | | URL | uRL |
| [nikitaksv/strcase](https://github.com/nikitaksv/strcase) | url | url | Url | url |
| [mantidtech/wordcase](https://github.com/mantidtech/wordcase) | url | url | URL | url |
| [dc0d/caseconv](https://github.com/dc0d/caseconv) | url | url | Url | url |
| [parithiban/stringcases](https://github.com/parithiban/stringcases) | u_r_l | u-r-l | URL | uRL |
| **ID** | - | - | - | - |
| [ettle/strcase](https://github.com/ettle/strcase) | id | id | Id | id |
| [gobeam/stringy](https://github.com/gobeam/stringy) | ID | ID | ID | |
| [stoewer/go-strcase](https://github.com/stoewer/go-strcase) | id | id | Id | id |
| [iancoleman/strcase](https://github.com/iancoleman/strcase) | id | id | Id | id |
| [pascaldekloe/name](https://github.com/pascaldekloe/name) | ID | | ID | iD |
| [nikitaksv/strcase](https://github.com/nikitaksv/strcase) | id | id | Id | id |
| [mantidtech/wordcase](https://github.com/mantidtech/wordcase) | id | id | ID | id |
| [dc0d/caseconv](https://github.com/dc0d/caseconv) | id | id | Id | id |
| [parithiban/stringcases](https://github.com/parithiban/stringcases) | i_d | i-d | ID | iD |
| **hostIP** | - | - | - | - |
| [ettle/strcase](https://github.com/ettle/strcase) | host_ip | host-ip | HostIp | hostIp |
| [gobeam/stringy](https://github.com/gobeam/stringy) | host_IP | host-IP | HostIP | |
| [stoewer/go-strcase](https://github.com/stoewer/go-strcase) | host_ip | host-ip | HostIp | hostIp |
| [iancoleman/strcase](https://github.com/iancoleman/strcase) | host_ip | host-ip | HostIP | hostIP |
| [pascaldekloe/name](https://github.com/pascaldekloe/name) | host_IP | | HostIP | hostIP |
| [nikitaksv/strcase](https://github.com/nikitaksv/strcase) | host_ip | host-ip | HostIp | hostIp |
| [mantidtech/wordcase](https://github.com/mantidtech/wordcase) | host_ip | host-ip | HostIP | hostIP |
| [dc0d/caseconv](https://github.com/dc0d/caseconv) | host_ip | host-ip | HostIp | hostIp |
| [parithiban/stringcases](https://github.com/parithiban/stringcases) | host_i_p | host-i-p | HostIP | hostIP |
| **JSON** | - | - | - | - |
| [ettle/strcase](https://github.com/ettle/strcase) | json | json | Json | json |
| [gobeam/stringy](https://github.com/gobeam/stringy) | JSON | JSON | JSON | |
| [stoewer/go-strcase](https://github.com/stoewer/go-strcase) | json | json | Json | json |
| [iancoleman/strcase](https://github.com/iancoleman/strcase) | json | json | JSON | jSON |
| [pascaldekloe/name](https://github.com/pascaldekloe/name) | JSON | | JSON | jSON |
| [nikitaksv/strcase](https://github.com/nikitaksv/strcase) | json | json | Json | json |
| [mantidtech/wordcase](https://github.com/mantidtech/wordcase) | json | json | JSON | json |
| [dc0d/caseconv](https://github.com/dc0d/caseconv) | json | json | Json | json |
| [parithiban/stringcases](https://github.com/parithiban/stringcases) | j_s_o_n | j-s-o-n | JSON | jSON |
| **JSONName** | - | - | - | - |
| [ettle/strcase](https://github.com/ettle/strcase) | json_name | json-name | JsonName | jsonName |
| [gobeam/stringy](https://github.com/gobeam/stringy) | JSONName | JSONName | JSONName | |
| [stoewer/go-strcase](https://github.com/stoewer/go-strcase) | json_name | json-name | Jsonname | jsonname |
| [iancoleman/strcase](https://github.com/iancoleman/strcase) | json_name | json-name | JSONName | jSONName |
| [pascaldekloe/name](https://github.com/pascaldekloe/name) | JSON_name | | JSONName | jSONName |
| [nikitaksv/strcase](https://github.com/nikitaksv/strcase) | jsonname | jsonname | Jsonname | jsonname |
| [mantidtech/wordcase](https://github.com/mantidtech/wordcase) | json_name | json-name | JSONName | jsonName |
| [dc0d/caseconv](https://github.com/dc0d/caseconv) | json_name | json-name | JsonName | jsonName |
| [parithiban/stringcases](https://github.com/parithiban/stringcases) | j_s_o_n_name | j-s-o-n-name | JSONName | jSONName |
| **NameJSON** | - | - | - | - |
| [ettle/strcase](https://github.com/ettle/strcase) | name_json | name-json | NameJson | nameJson |
| [gobeam/stringy](https://github.com/gobeam/stringy) | Name_JSON | Name-JSON | NameJSON | |
| [stoewer/go-strcase](https://github.com/stoewer/go-strcase) | name_json | name-json | NameJson | nameJson |
| [iancoleman/strcase](https://github.com/iancoleman/strcase) | name_json | name-json | NameJSON | nameJSON |
| [pascaldekloe/name](https://github.com/pascaldekloe/name) | name_JSON | | NameJSON | nameJSON |
| [nikitaksv/strcase](https://github.com/nikitaksv/strcase) | name_json | name-json | NameJson | nameJson |
| [mantidtech/wordcase](https://github.com/mantidtech/wordcase) | name_json | name-json | NameJSON | nameJSON |
| [dc0d/caseconv](https://github.com/dc0d/caseconv) | name_json | name-json | NameJson | nameJson |
| [parithiban/stringcases](https://github.com/parithiban/stringcases) | name_j_s_o_n | name-j-s-o-n | NameJSON | nameJSON |
| **UneTête** | - | - | - | - |
| [ettle/strcase](https://github.com/ettle/strcase) | une_tête | une-tête | UneTête | uneTête |
| [gobeam/stringy](https://github.com/gobeam/stringy) | Une_Tête | Une-Tête | UneTête | |
| [stoewer/go-strcase](https://github.com/stoewer/go-strcase) | une_tête | une-tête | UneTête | uneTête |
| [iancoleman/strcase](https://github.com/iancoleman/strcase) | une_tête | une-tête | UneTte | uneTte |
| [pascaldekloe/name](https://github.com/pascaldekloe/name) | une_tête | | UneTête | uneTête |
| [nikitaksv/strcase](https://github.com/nikitaksv/strcase) | une_tête | une-tête | UneTête | uneTête |
| [mantidtech/wordcase](https://github.com/mantidtech/wordcase) | une_tête | une-tête | UneTête | uneTête |
| [dc0d/caseconv](https://github.com/dc0d/caseconv) | une_tête | une-tête | UneTête | uneTête |
| [parithiban/stringcases](https://github.com/parithiban/stringcases) | une_tête | une-tête | UneTête | uneTête |

### github.com/ettle/strcase

| Source | Snake | Kebab | Pascal Case | Camel Case |
|----------------|---------------------|---------------------|---------------------|---------------------|
| GooID | goo_id | goo-id | GooId | gooId |
| HTTPStatusCode | http_status_code | http-status-code | HttpStatusCode | httpStatusCode |
| FooBAR | foo_bar | foo-bar | FooBar | fooBar |
| URL | url | url | Url | url |
| ID | id | id | Id | id |
| hostIP | host_ip | host-ip | HostIp | hostIp |
| JSON | json | json | Json | json |
| JSONName | json_name | json-name | JsonName | jsonName |
| NameJSON | name_json | name-json | NameJson | nameJson |
| UneTête | une_tête | une-tête | UneTête | uneTête |

### github.com/gobeam/stringy

| Source | Snake | Kebab | Pascal Case | Camel Case |
|----------------|---------------------|---------------------|---------------------|---------------------|
| GooID | Goo_ID | Goo-ID | GooID | |
| HTTPStatusCode | HTTPStatus_Code | HTTPStatus-Code | HTTPStatusCode | |
| FooBAR | Foo_BAR | Foo-BAR | FooBAR | |
| URL | URL | URL | URL | |
| ID | ID | ID | ID | |
| hostIP | host_IP | host-IP | HostIP | |
| JSON | JSON | JSON | JSON | |
| JSONName | JSONName | JSONName | JSONName | |
| NameJSON | Name_JSON | Name-JSON | NameJSON | |
| UneTête | Une_Tête | Une-Tête | UneTête | |

### github.com/stoewer/go-strcase

| Source | Snake | Kebab | Pascal Case | Camel Case |
|----------------|---------------------|---------------------|---------------------|---------------------|
| GooID | goo_id | goo-id | GooId | gooId |
| HTTPStatusCode | http_status_code | http-status-code | HttpstatusCode | httpstatusCode |
| FooBAR | foo_bar | foo-bar | FooBar | fooBar |
| URL | url | url | Url | url |
| ID | id | id | Id | id |
| hostIP | host_ip | host-ip | HostIp | hostIp |
| JSON | json | json | Json | json |
| JSONName | json_name | json-name | Jsonname | jsonname |
| NameJSON | name_json | name-json | NameJson | nameJson |
| UneTête | une_tête | une-tête | UneTête | uneTête |

### github.com/iancoleman/strcase

| Source | Snake | Kebab | Pascal Case | Camel Case |
|----------------|---------------------|---------------------|---------------------|---------------------|
| GooID | goo_id | goo-id | GooID | gooID |
| HTTPStatusCode | http_status_code | http-status-code | HTTPStatusCode | hTTPStatusCode |
| FooBAR | foo_bar | foo-bar | FooBAR | fooBAR |
| URL | url | url | URL | uRL |
| ID | id | id | Id | id |
| hostIP | host_ip | host-ip | HostIP | hostIP |
| JSON | json | json | JSON | jSON |
| JSONName | json_name | json-name | JSONName | jSONName |
| NameJSON | name_json | name-json | NameJSON | nameJSON |
| UneTête | une_tête | une-tête | UneTte | uneTte |

### github.com/pascaldekloe/name

| Source | Snake | Kebab | Pascal Case | Camel Case |
|----------------|---------------------|---------------------|---------------------|---------------------|
| GooID | goo_ID | | GooID | gooID |
| HTTPStatusCode | HTTP_status_code | | HTTPStatusCode | hTTPStatusCode |
| FooBAR | foo_BAR | | FooBAR | fooBAR |
| URL | URL | | URL | uRL |
| ID | ID | | ID | iD |
| hostIP | host_IP | | HostIP | hostIP |
| JSON | JSON | | JSON | jSON |
| JSONName | JSON_name | | JSONName | jSONName |
| NameJSON | name_JSON | | NameJSON | nameJSON |
| UneTête | une_tête | | UneTête | uneTête |

### github.com/nikitaksv/strcase

| Source | Snake | Kebab | Pascal Case | Camel Case |
|----------------|---------------------|---------------------|---------------------|---------------------|
| GooID | goo_id | goo-id | GooId | gooId |
| HTTPStatusCode | httpstatus_code | httpstatus-code | HttpstatusCode | httpstatusCode |
| FooBAR | foo_bar | foo-bar | FooBar | fooBar |
| URL | url | url | Url | url |
| ID | id | id | Id | id |
| hostIP | host_ip | host-ip | HostIp | hostIp |
| JSON | json | json | Json | json |
| JSONName | jsonname | jsonname | Jsonname | jsonname |
| NameJSON | name_json | name-json | NameJson | nameJson |
| UneTête | une_tête | une-tête | UneTête | uneTête |

### github.com/mantidtech/wordcase

| Source | Snake | Kebab | Pascal Case | Camel Case |
|----------------|---------------------|---------------------|---------------------|---------------------|
| GooID | goo_id | goo-id | GooID | gooID |
| HTTPStatusCode | http_status_code | http-status-code | HTTPStatusCode | httpStatusCode |
| FooBAR | foo_bar | foo-bar | FooBar | fooBar |
| URL | url | url | URL | url |
| ID | id | id | ID | id |
| hostIP | host_ip | host-ip | HostIP | hostIP |
| JSON | json | json | JSON | json |
| JSONName | json_name | json-name | JSONName | jsonName |
| NameJSON | name_json | name-json | NameJSON | nameJSON |
| UneTête | une_tête | une-tête | UneTête | uneTête |

### github.com/dc0d/caseconv

| Source | Snake | Kebab | Pascal Case | Camel Case |
|----------------|---------------------|---------------------|---------------------|---------------------|
| GooID | goo_id | goo-id | GooId | gooId |
| HTTPStatusCode | http_status_code | http-status-code | HttpStatusCode | httpStatusCode |
| FooBAR | foo_bar | foo-bar | FooBar | fooBar |
| URL | url | url | Url | url |
| ID | id | id | Id | id |
| hostIP | host_ip | host-ip | HostIp | hostIp |
| JSON | json | json | Json | json |
| JSONName | json_name | json-name | JsonName | jsonName |
| NameJSON | name_json | name-json | NameJson | nameJson |
| UneTête | une_tête | une-tête | UneTête | uneTête |

### github.com/parithiban/stringcases

| Source | Snake | Kebab | Pascal Case | Camel Case |
|----------------|---------------------|---------------------|---------------------|---------------------|
| GooID | goo_i_d | goo-i-d | GooID | gooID |
| HTTPStatusCode | h_t_t_p_status_code | h-t-t-p-status-code | HTTPStatusCode | hTTPStatusCode |
| FooBAR | foo_b_a_r | foo-b-a-r | FooBAR | fooBAR |
| URL | u_r_l | u-r-l | URL | uRL |
| ID | i_d | i-d | ID | iD |
| hostIP | host_i_p | host-i-p | HostIP | hostIP |
| JSON | j_s_o_n | j-s-o-n | JSON | jSON |
| JSONName | j_s_o_n_name | j-s-o-n-name | JSONName | jSONName |
| NameJSON | name_j_s_o_n | name-j-s-o-n | NameJSON | nameJSON |
| UneTête | une_tête | une-tête | UneTête | uneTête |

Notes:

- https://github.com/ettle/strcase is able to create names with "Golint Initialisms".
- https://github.com/parithiban/stringcases panics with empty string and a string with only special characters.

## Summary

https://github.com/ettle/strcase seems to be the library with the best and largest possibilities, at least for my use case.

## Libs

- https://github.com/ettle/strcase
- https://github.com/gobeam/stringy
- https://github.com/iancoleman/strcase
- https://github.com/mantidtech/wordcase
- https://github.com/nikitaksv/strcase
- https://github.com/parithiban/stringcases
- https://github.com/pascaldekloe/name
- https://github.com/stoewer/go-strcase

others:

- https://github.com/segmentio/go-camelcase
- https://github.com/segmentio/go-snakecase

## Golint Initialisms

https://github.com/golang/lint/blob/83fdc39ff7b56453e3793356bcff3070b9b96445/lint.go#L770-L809

```go
var commonInitialisms = map[string]bool{
"ACL": true,
"API": true,
"ASCII": true,
"CPU": true,
"CSS": true,
"DNS": true,
"EOF": true,
"GUID": true,
"HTML": true,
"HTTP": true,
"HTTPS": true,
"ID": true,
"IP": true,
"JSON": true,
"LHS": true,
"QPS": true,
"RAM": true,
"RHS": true,
"RPC": true,
"SLA": true,
"SMTP": true,
"SQL": true,
"SSH": true,
"TCP": true,
"TLS": true,
"TTL": true,
"UDP": true,
"UI": true,
"UID": true,
"UUID": true,
"URI": true,
"URL": true,
"UTF8": true,
"VM": true,
"XML": true,
"XMPP": true,
"XSRF": true,
"XSS": true,
}
```