Sublime text - fragment with the capitalization of the first letter param

I want to make a snippet for Sublime Text 2 or 3, which produces the following code:

initial - somename with upper case - Somename 

and somename is text that will always be different.

My project for this:

 <snippet> <content><![CDATA[ initial - ${2:somename} with upper case - ${2:somename} ]]></content> </snippet> 

But how can I smooth only the first letter in a parameter?

+5
source share
1 answer

The final version:

 <snippet> <content><![CDATA[ initial - ${1:somename} with upper case - ${1/(.+)/\u$1/g} ]]></content> </snippet> 
+10
source

Source: https://habr.com/ru/post/1232193/


All Articles