Question

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

Était-ce utile?

La solution

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) }
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top