1

How can I make the first letter upper case in the following:

${1:${TM_FILENAME/[\.php]+$//}}

Basically if the filename is "welcome.php", I'd like it to write out "Welcome". This at the moment writes "welcome" (lower case w).

Hopstream
  • 6,391
  • 11
  • 50
  • 81

3 Answers3

1

Try the following snippet. Works for me.

${TM_FILENAME/(.*?)(\..+)/\u$1/}
Derek Prior
  • 3,497
  • 1
  • 25
  • 30
0

TM_FILENAME not works for windows?

Bruno Batista
  • 223
  • 3
  • 11
0

For some reason the above example gives you weird charectors when using it ... it took me a while but the solution below works if you are still looking. It has two solutions here for you the first one is for actual textmate on mac:

${TM_FILENAME/(^.)(.*?)(\.php)/(?1:\U$1)(?2:)(?3:)/}

The next is if you are using e Texteditor on PC:

${TM_FILENAME/(^.)(.*?)(\.php)/(?1:)(?2:$2)(?3:)/}

I hope this helps you if you haven't already.

BrandonS
  • 932
  • 7
  • 16