2

I've looked everywhere and I can't seem to find an answer, maybe because I don't know enough to know what to search for.

I've used the Get-PluralizedWord function.

Is there a similar way to convert a given word like MyClass, to myClass in powershell/T4Templates ?

Cheers,

James

Jamez
  • 1,559
  • 1
  • 15
  • 26

1 Answers1

7

To convert a given word like MyClass to myClass, you can use a .net regex replace:

[Regex]::Replace("MyClass" , '\b.', {  $args[0].Value.Tolower() })

or substring manipulation:

"MyClass" | % { $_.substring(0,1).tolower()+$_.substring(1) }
CB.
  • 58,865
  • 9
  • 159
  • 159