- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
这个名字背后的原因是什么?
SS64在 PowerShell 中解释此处的字符串如下:
A here string is a single-quoted or double-quoted string which can span multiple lines.Expressions in single-quoted strings are not evaluated.
All the lines in a here-string are interpreted as strings, even though they are not enclosed in quotation marks.
$myHereString = @'
some text with "quotes" and variable names $printthis
some more text
'@
最佳答案
它们在 PowerShell 中有这个名称,因为它是从 Unix 风格的 shell 中借来的,就像 PowerShell 中的许多其他元素和概念一样:
From Wikipedia :
Here documents originate in the Unix shell, and are found in sh, csh, ksh, bash and zsh, among others.
In computing, a here document (here-document, here-text, heredoc, hereis, here-string or here-script) is a file literal or input stream literal: it is a section of a source code file that is treated as if it were a separate file. The term is also used for a form of multiline string literals that use similar syntax, preserving line breaks and other whitespace (including indentation) in the text.
[string]
s,像这样:
$myString = 'some text with "quotes" and variable names $printthis
some more text'
这里字符串有用的一个更好的例子是当你需要两种类型的引号时:
$myHereString = @'
some text with "quotes" and variable names $printthis
some more text
and my grandma's soup
'@
如果这只是一个单引号字符串,则
'
在
grandma's
将需要逃脱。
"
的实例。你需要逃离
$
如果你不想变量扩展。
关于string - 为什么 "Here Strings"被称为 "Here Strings"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41454502/
我是一名优秀的程序员,十分优秀!