Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sublime text - snippet with capitalization of param first letter

I want to make snippet for Sublime Text 2 or 3 which will produce the following code:

initial - somename
with upper case - Somename

and somename is text which will be always different.

My draft for this:

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

But how can I uppercase only first letter in parameter?

like image 652
nktssh Avatar asked Sep 24 '15 13:09

nktssh


Video Answer


1 Answers

Final variant:

<snippet>
    <content><![CDATA[
initial - ${1:somename}
with upper case - ${1/(.+)/\u$1/g}
]]></content>
</snippet>
like image 138
nktssh Avatar answered Sep 24 '22 16:09

nktssh