File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed
Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -15,11 +15,33 @@ private static readonly Regex RouteParameterRegex
1515 public static string ToCamelCaseFromPascalCase ( string inPascalCase )
1616 {
1717 if ( ! string . IsNullOrEmpty ( inPascalCase ) )
18- return $ "{ inPascalCase . First ( ) . ToString ( ) . ToLower ( ) } { inPascalCase . Substring ( 1 ) } ";
18+ return $ "{ char . ToLower ( inPascalCase . First ( ) ) } { inPascalCase . Substring ( 1 ) } ";
1919 else
2020 return inPascalCase ;
2121 }
2222
23+ public static string ToPascalCaseFromCamelCase ( string inCamelCase )
24+ {
25+ if ( ! string . IsNullOrEmpty ( inCamelCase ) )
26+ return $ "{ char . ToUpper ( inCamelCase . First ( ) ) } { inCamelCase . Substring ( 1 ) } ";
27+ else
28+ return inCamelCase ;
29+ }
30+
31+ public static string ToPascalCaseFromKebabCase ( string inKebabCase )
32+ {
33+ if ( ! string . IsNullOrEmpty ( inKebabCase ) )
34+ {
35+ var parts = inKebabCase
36+ . Split ( new [ ] { '-' } , StringSplitOptions . RemoveEmptyEntries )
37+ . Select ( v => $ "{ char . ToUpper ( v . First ( ) ) } { v . Substring ( 1 ) } ") ;
38+
39+ return string . Join ( string . Empty , parts ) ;
40+ }
41+ else
42+ return inKebabCase ;
43+ }
44+
2345 public static string GetBaseEndpoint ( List < WebApiRoutePart > routeParts )
2446 {
2547 var baseEndpointParts = routeParts
You can’t perform that action at this time.
0 commit comments