iancoleman / strcase

A golang package for converting to snake_case or CamelCase
MIT License
1.02k stars 110 forks source link

Fix error in TolowerCamel when deal with strings with ID #15

Closed jonyhy96 closed 4 years ago

jonyhy96 commented 5 years ago

Description

When i was using this package to deal with field like 'UserID' and 'ID',I found it won't change the original word correctly into 'userId' and 'Id'

Solution

User strings to check if there is 'ID' contains in the string,then replace the 'ID' with 'Id' when strings.Contains() return other than -1.

jonyhy96 commented 5 years ago

/cc @iancoleman