了解 Liquid 運算子

注意

自 2022 年 10 月 12 日起,Power Apps 入口網站為 Power Pages。 其他資訊:Microsoft Power Pages 現在已推出 (部落格)
我們很快就會遷移並將 Power Apps 入口網站文件與 Power Pages 文件併合。

Liquid 可存取所有常用的邏輯和比較運算子。 這些都可在標籤中使用,像是 ifunless

基本運算子

== 等於
!= 不等於
> 大於
< 小於
>= 大於或等於
<= 小於或等於
條件 A 條件 B
條件 A 條件 B

contains

contains 測試字串內是否有子字串存在。

{% if page.title contains 'Product' %}

The title of this page contains the word Product.

{% endif %}

contains 也可以測試字串陣列中是否有某個字串存在。

startswith

startswith 測試字串是否以特定子字串開頭。

{% if page.title startswith 'Profile' %}

This is a profile page.

{% endif %}

endswith

endswith 測試字串是否以特定子字串結尾。

{% if page.title endswith 'Forum' %}

This is a forum page.

{% endif %}

請參閱

使用網站範本儲存來源內容
Liquid 類型
條件
Liquid 物件
Liquid 標籤
Liquid 篩選

注意

是否能請您告知您偏好的慣用文件語言? 請填寫問卷。 (請注意,本問卷為英文版)

完成問卷大約需要七分鐘。 本問卷將不會收集個人資料 (隱私權聲明)。