Skip to content

Retain Acronyms when casing #8

@TristanSpeakEasy

Description

@TristanSpeakEasy

Hi, great library btw it has been very helpful with code gen work we are doing!

What did you do?

strcase.ToCamel("nativeOrgURL")

What did you expect to see?

output == "nativeOrgURL"

What did you see instead?

output == "nativeOrgUrl"

I was looking through the options of creating a custom caser and thought omitting the SplitAcronym option may have produced the output I would have expected.

But basically I would like to be able to pass a string and be able to retain any acronyms that are contained within without needing to understand the input and try and populate the initialisms map with any acronyms I want to retain (as the input comes from end-users so we could receive any acronym), I can't really use strcase.ToGoCamel as it initializes acronyms that weren't initially upper case ie nativeOrgUrl as we are generating code for languages other than Go.

Basically if

input = "nativeOrgURL" then output = "nativeOrgURL"
input = "nativeOrgUrl" then output = "nativeOrgUrl"

I don't see a way to achieve this at the moment with the library, any help figuring out if this is possible would be appreciated.

while it looks like I am just trying to have a noop in the case of the examples above we could receive inputs that are of any case for example native_org_url or NativeOrgURL and want to format to nativeOrgUrl or nativeOrlURL to produce properties names suitable for a typescript class for example

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions