本文介绍了如何在 VS Code Snippet 中插入字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
尝试在 VS Code 中创建一个时间戳片段,生成 yyyy-MM-ddThh:mm:ssZ
.
Trying to create a timestamp snippet in VS Code that produces yyyy-MM-ddThh:mm:ssZ
.
目前尝试过:
$CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATE","T","$CURRENT_HOUR:$CURRENT_MINUTE:$CURRENT_SECOND","Z"
但逗号将每个部分放在一个新的线.
$CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATE","T","$CURRENT_HOUR:$CURRENT_MINUTE:$CURRENT_SECOND","Z"
but the commas place each section on a new line.
2021-06-27
T
08:57:03
Z
我如何获得T"?和Z"字符内联在这里?
How do I get the "T" and "Z" characters inline here?
推荐答案
你必须做两件事:
- 将整个内容放在一行 -
,
被视为换行符. - 将每个变量包装在
${....}
中,以便它们与紧挨着的其他字符T
和Z
一起正常工作他们.否则无法正确解释变量.所以:
- Put the whole thing on one line - the
,
's are seen as line breaks. - Wrap each variable in
${....}
so that they work properly with the other charctersT
andZ
right next to them. Otherwise the variables cannot be interpreted properly. So:
"${CURRENT_YEAR}-${CURRENT_MONTH}-${CURRENT_DATE}T${CURRENT_HOUR}:${CURRENT_MINUTE}:${CURRENT_SECOND}Z"
这篇关于如何在 VS Code Snippet 中插入字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!