竖线“|”是什么意思在 Delphi 7?

What is the meaning of a pipe "|" in Delphi 7?

正如标题所说,我想知道管道(或管)“|”是什么意思在 Delphi 代码中。请参阅该屏幕截图:

我知道“*”的意思,它是一个或多个字符的通配符,但我找不到“|”的意思。

谢谢

对于 TOpenDialog 这只是在 Filter 的一行中指定的语法:

  • 友好的类型名称(此处:Regles de chaurfage
  • 与类型相关的文件扩展名(此处.fuz

这不是语言运算符。这只是 TOpenDialog 正在使用的某种约定。

这是一个可以通过阅读文档来回答的问题。可以在这里找到:

Vcl.Dialogs.TOpenDialog.Filter

To create file masks in program code, assign a value to the Filter property that consists of a description and a mask separated by a vertical bar (pipe) character. Do not include spaces around the vertical bar. For example,

OpenDialog1.Filter := 'Text files (*.txt)|*.TXT';

Multiple filters should be separated by vertical bars. For example,

OpenDialog1.Filter := 'Text files (*.txt)|*.TXT|Pascal files (*.pas)|*.PAS';

To include multiple masks in a single filter, separate the masks with semicolons. This works both in the Object Inspector and in program code. For example,

OpenDialog1.Filter := 'Pascal files|*.PAS;*.DPK;*.DPR';

您可能希望吸收此处找到的提示 (How can I search for Delphi documentation?),以便在将来对您有所帮助。

管道将过滤器表达式(右侧)与用户将看到的标题(左侧)分开。如果要应用多个过滤器,只需附加它,也用竖线分隔。

Multiple filters should be separated by vertical bars.

http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/delphivclwin32/Dialogs_TOpenDialog_Filter.html

在Delphi中,|字符经常在某些字符串属性中用作分隔符以区分: