MCPcopy Index your code
hub / github.com/oapi-codegen/oapi-codegen / replaceInitialism

Function replaceInitialism

pkg/codegen/utils.go:324–334  ·  view source on GitHub ↗
(s string)

Source from the content-addressed store, hash-verified

322}
323
324func replaceInitialism(s string) string {
325 // These strings do not apply CamelCase
326 // Do not do CamelCase when these characters match when the preceding character is lowercase
327 return targetWordRegex.ReplaceAllStringFunc(s, func(s string) string {
328 // If the preceding character is lowercase, do not do CamelCase
329 if unicode.IsLower(rune(s[0])) {
330 return s
331 }
332 return strings.ToUpper(s)
333 })
334}
335
336// mediaTypeToCamelCase converts a media type to a PascalCase representation
337func mediaTypeToCamelCase(s string) string {

Callers 2

Test_replaceInitialismFunction · 0.85

Calls

no outgoing calls

Tested by 1

Test_replaceInitialismFunction · 0.68