问题描述
我想制作一个类似的模板$ NAME $ other $ LOWNAME $
这样当我使用它时,我被带到$ NAME $输入列表和$ LOWNAME $自动填充$ NAME $ I输入的资本化值。例如,我将Client打印到$ NAME $,$ LOWNAME $的值为client。这是可能的吗?
I want to make a template like something $NAME$ other $LOWNAME$
so that when I use it, I'm taken to $NAME$ input list and $LOWNAME$ is automatically filled with decapitalized value of $NAME$ I input. For example, I print "Client" to $NAME$ and the value of $LOWNAME$ is "client". Is this possible?
推荐答案
如果通过decapitalizing你的意思是小写只有第一个字母那么是,否则为否(因为没有下壳所有字符的功能)。
If by "decapitalizing" you mean to lower case only first letter then YES, otherwise No (as there is no function for lower casing all characters).
- 模板:
$ NAME $ other $ LOWNAME $
- 点击编辑变量按钮
- 在LOWNAME的表达式列中变量输入:
decapitalize(NAME)
并勾选/勾选如果已定义则跳过框
- Template:
something $NAME$ other $LOWNAME$
- Click on "Edit variables" button
- In "Expression" column for "LOWNAME" variable enter this:
decapitalize(NAME)
and tick/check "Skip if defined" box
现在,当模板将被展开时,如果您为 $ NAME $
变量输入CapitalShip,则
$ LOWNAME $
将自动成为capitalShip
Now when template will be expanded, and if you enter "CapitalShip" for $NAME$
variable, the $LOWNAME$
will automatically become "capitalShip"
这篇关于如何将PHPStorm实时模板变量定义为另一个变量的小写值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!