The last of Scala's control constructs you'll learn about today is match, which provides much of Scala's pattern-matching capabilities.
今天要了解的最后一个Scala控制结构是match,它提供了许多Scala模式匹配功能。
Match a pattern in the tree and modify the tree.
匹配树中的模式,并修改树。
Add the root template—that is, <xsl:template match="/">—and fill it with the pattern of the HTML document, including both the header and the footer.
添加根模板 —即 <xsl:templatematch="/"> —填入HTML的模式,包括头部和底部。
The hosts.deny is then searched for a pattern match.
然后在 hosts.deny 中搜索匹配的模式。
This function literal does a pattern match on the message instance to decide how to handle the message.
这个字面函数给消息做了一个模式匹配来决定它被如何处理。
Pattern match search oriented to planar graphs is widely used in biological networks, social networks, fingerprint identification and image segmentation.
平面图的模式匹配查询可广泛应用于生物网络、社会网络、指纹识别和图像分割等。
It is surprisingly simple: the name itself differs, so we can use a simple pattern match on the name field.
令人惊奇的简单:只是名字上的区别,所以我们可在NAME域上使用一个简单的模式匹配。
Our pattern match then looks for Alice and Bob by inspecting the values passed to the constructor of the Person case class.
然后,我们的模式匹配通过检查传入的Personcase类的值来查找Alice和Bob。
Since we are now using SQL SELECT statements, the restore_where argument changes from a Perl pattern match to the syntax of an SQL where clause.
因为现在使用的是SQLselect语句,所以restore_where自变量从Perl模式匹配改成SQL where子句。
To find these concepts in text, you can specify rules that define a pattern to match these concepts.
为了在文本中寻找这些概念,可以通过指定规则定义匹配这些概念的模式。
You can search for strings in vi using the / command, specifying the pattern to match either as a literal string or as a regular expression.
在vi 中,可以使用 /命令搜索字符串,这需要以字面字符串或正则表达式的形式指定要匹配的模式。
With these alone, you can match most any pattern of a predictable length.
仅使用这些内容,就可以匹配大多数具有可预测长度的模式。
For example, the pattern o {2} would match two (and only two) o characters.
例如,模式o{2}将匹配两个(仅仅两个)o字符。
If you want to match a pattern multiple times within a character sequence, the above code snippets are a good place to start.
如果您想在一个字符序列中多次匹配一个模式,上面的代码片段是一个很好的起点。
Similar to resolve, this method also returns an array of config objects, since multiple config objects can match the pattern.
与resolve类似,这个方法也会返回一个配置对象数组,因为许多配置对象都可以匹配这种模式。
The general rule to remember is that the ODR tries to match the most specific pattern.
需要牢记,一般规则是ODR试图匹配最具体的模式。
The query attempts to match the triples of the graph pattern to the model.
这个查询试图把图形模式的三元模式和模型进行匹配。
You can use this pattern at the end of any sequence match to remove length as a condition.
你可以在任何序列匹配的最后使用这个模式来解除长度制约。
A list of all classes in the project's build path that match that pattern are presented in a list, from which you can select the class and package name you want to use.
将在一个列表中显示与该模式匹配的项目构建路径中的所有类,您可以从此列表中选择您希望使用的类名称和包名称。
Then it executes a couple of find commands to search the file system for files that match a pattern and to append them to the TempList.
然后它执行两个find命令来搜索文件系统中匹配某个模式的文件,并将它们附加到TempList。
It proceeds through each one, trying to match the input form to the pattern and, if it matches, it produces the associated expansion.
它依次通过每个组合进行处理,尝试将输入形式与模式进行匹配,如果匹配的话,它就产生相关联的展开形式。
A tool like awk is preferable to grep when you want to match the pattern in only a specific field in the lines of output and not just anywhere in the lines.
当您只希望匹配输出行中特定字段中的模式时,诸如awk等工具要优于grep。
An initial scan of the input directory when the flow is started populates a list of input files that match the input pattern and are waiting to be processed by the message flow.
流启动时的初始输入目录扫描将填充与输入模式匹配并等待由消息流处理的输入文件列表。
It will match the URL to this pattern and put the last part of the URL in a variable called name.
它将URL与该模式匹配,并将URL的最后部分放到一个名为name的变量中。
While an index on a relational column contains all values from that column, an XML index contains only values of nodes that match both the XML pattern and the data type in the index definition.
关系列上的索引包含了此列的所有值,而xml索引仅包含那些同时匹配XML模式和索引定义中的数据类型的节点值。
This function attempts to match and return a specific occurrence of a pattern that is defined by the regular expression against the source string.
此函数试图匹配并返回正则表达式针对源字符串定义的模式的特定发生项。
You can use an underscore (Scala's standard wild card character) as a placeholder to catch any type of exception (really, to match any case in a pattern matching expression).
你可以使用一个下划线(Scala的标准通配符)作为占位符来捕捉任意类型的异常(不骗你,它可以匹配模式匹配表达式的任何case)。
In order to correctly match left and right contexts around the cursor, it needs to ensure the pattern matches only at the cursor's column.
为了正确地在光标周围匹配左边和右边上下文,要确保该模式仅在光标所在的列进行匹配。
The function, preg_grep , makes processing a list very easy: Simply provide the pattern as the first argument and an array of words to match as the second argument.
使用函数preg_grep可以非常轻松地处理列表:只需提供模式作为第一个参数,并提供要匹配的单词数组作为第二个参数。
The two sides of the operation must match (that is, if you have 2 element tuple as the pattern, the expression must resolve to a 2 element tuple).
操作的两边必须匹配(也就是说,如果模式是包含两个元素的元组,那么表达式的计算结果也必须是包含两个元素的元组)。
应用推荐