Is it possible to do a substring on a template variable?

I have a constant variable named “Environment” and it refers to the deployed environment name. This environment can contain “dev”, “int” or “prod”.

What I’d like to do is reference only the first character of each possible string so that I get “d”,“i” or “p”.

Is there a way to apply a substring function to a template variable?

For example: {{environment.sustring(1,1)}} or $environment[1,1]