'Mustache: How to downcase first letter

I'm using a mustache template in order to generate some code using Java.

I'd like to downcase the first letter of a field.

Is there some way to get it?

I need to transform it directly. I'm generating C# code.

EDIT

I'm using Swagger Codegen tool in order to be able to generate a client according to a API Specification.

This tool is using mustache templates for generating an output. So, there's a template for each language you need. See here, in order to watch the mustache templates that Swagger Codegen provides.

I'm modifying these in order to customize the C# code I want to reach.

{{#apiInfo}}
{{#apis}}
    this.{{classname}} = new {{apiPackage}}.{{classname}}(this.Configuration);
{{/apis}}
{{/apiInfo}}

It has to generate something like:

this.UserAPI = new Api.UserAPI(this.Configuration);

I'd like to get:

this.userAPI = new Api.UserAPI(this.Configuration);


Solution 1:[1]

Since the question is specific to swagger codegen tool they have lambda functions for mustache.

{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}

Try:

this.{{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}} = new {{apiPackage}}.{{classname}}(this.Configuration);

Look for examples in template: https://github.com/swagger-api/swagger-codegen/blob/master/modules/swagger-codegen/src/main/resources/csharp/modelGeneric.mustache

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 serg