> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kasoftware.com/llms.txt
> Use this file to discover all available pages before exploring further.

# arc:case

> 在 arc:select 中定義條件分支，當選擇值與 case 值匹配時執行，並支援精確、正則和 glob 匹配。

export const siteNameShort = "知行之橋";

arc:case 關鍵字和 [arc:select](./op-arc-select) 關鍵字一起使用。arc:case 關鍵字由一個 ArcScript 塊組成，只有當 [arc:select](./op-arc-select) 中的值與 arc:case 中的值匹配時才會執行。

## 參數

* **value**：與 [arc:select](./op-arc-select) 中指定的值進行比較的模式或值。
* **match**：匹配的型別，用於確定是否應執行 case 語句。預設值是 “exact”, 需要值完全匹配。其它支援的型別有 “regex”，用作規則運算式匹配，以及 “glob”，支援一種簡單的運算式模型，和檔名模式中使用的類似（例如 \*.txt）。應用程式的 .NET 版本使用 .NET 框架版本的規則運算式匹配。Java 版本使用 Java 規則運算式構造。

## 控制屬性

無

## 範例

根據條件顯示圖示。arc:case 元素與 company\_name 屬性中的 `CompanyA` 和 `CompanyB` 進行匹配，如果發現任何匹配項，就會採取與該項關聯的操作。

```xml theme={null}
<arc:select value="[company_name]">
  <arc:case value="CompanyA">
    <img src="http://www.companya.com/favicon.ico" />
  </arc:case>
  <arc:case value="CompanyB">
    <img src="http://www.companyb.com/favicon.ico" />
  </arc:case>
  <arc:default>
    <img src="http://www.myhosting.com/generic.ico"/>
  </arc:default>
</arc:select>
```

## 另請參閱

* [arc:select](./op-arc-select)：編寫一個多選 ArcScript 塊。
* [arc:default](./op-arc-default)：為 [arc:select](./op-arc-select) 編寫一個預設的情況。
