Replace selected text with processed text macro/script?
已回答
Hello,
I have multiple documents where I have to find specific strings (manually, according to my interpretation) and replace them with processed strings. Example:
<p>this is a short test string</p>
I will select "short text string" and I want it converted to
<p>this is a <?php $lang->item("short_text_string") ?></p>
(the script should replace spaces with "_", lowercase, add some text before and after, etc)
How should I approach this? In other IDEs I used some sort of macros, but they don't seem to work that well in PHPStorm (try it and you'll find out how you cannot apply replace and lowercase consecutively)
Thanks!
Marc
请先登录再写评论。
Use the Surround live templates that work with $SELECTION$: https://www.jetbrains.com/help/idea/template-variables.html#pdtv.
For more advanced stuff there is groovyScript function inside the template that can work with the selected fragment.