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

Function ToCamelCaseWithInitialisms

pkg/codegen/utils.go:285–293  ·  view source on GitHub ↗

ToCamelCaseWithInitialisms function will convert query-arg style strings to CamelCase with initialisms in uppercase. So, httpOperationId would be converted to HTTPOperationID

(s string)

Source from the content-addressed store, hash-verified

283// ToCamelCaseWithInitialisms function will convert query-arg style strings to CamelCase with initialisms in uppercase.
284// So, httpOperationId would be converted to HTTPOperationID
285func ToCamelCaseWithInitialisms(s string) string {
286 parts := camelCaseMatchParts.FindAllString(ToCamelCaseWithDigits(s), -1)
287 for i := range parts {
288 if v, ok := globalState.initialismsMap[strings.ToLower(parts[i])]; ok {
289 parts[i] = v
290 }
291 }
292 return strings.Join(parts, "")
293}
294
295var camelCaseMatchParts = regexp.MustCompile(`[\p{Lu}\d]+([\p{Ll}\d]+|$)`)
296

Callers 1

Calls 1

ToCamelCaseWithDigitsFunction · 0.85

Tested by 1