> ## 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.

# messageReadLine

> 從當前訊息中讀取一行內容，支援指定行號和編碼。

逐行讀取和列舉訊息項的內容，並從訊息中逐行傳回。

## 可選的參數

* **separator**：決定每一行的分隔符號。預設值是換行字元（`\n`）。
* **encoding**：用於將訊息資料解碼為字串的編碼。允許的值由所使用的 JVM/OS 決定。大多數作業系統和 JVM 通常支援的編碼值包括`UTF-8`、`ASCII`、`BASE64`、`Hex`、`windows-1252`和`ISO-8859-2`。預設值為 `UTF-8`。

## 輸出屬性

* **line**: 從訊息中推送出去的資料的行號。
* **data**：訊息中的行資料。

## 範例

### 僅將第一行的 ABC 替換為 DEF

```xml theme={null}
<!-- Initializing the item to hold the message data minus the first line -->
<arc:set attr="restof.data" value="" />
<!-- Calling the messageReadLine operation and setting the output item -->
<arc:call op="messageReadLine" out="result" >
  <!-- Once the operation gets to the first line in the message data, perform a replace -->
  <arc:if exp="[result.line] == 1">
    <arc:set attr="first.line" value="[result.data | replace('Owen','Liu')]" />
    <arc:else>
      <!-- Setting the data for the output message to be the concatenation of the modified first line and the rest of the message data -->
      <arc:set attr="output.data" value="[first.line][restof.data]\n[result.data]" />
    </arc:else>
  </arc:if> 
</arc:call>
<arc:set attr="output.filepath" value="[FilePath]" />
<arc:push item="output" />
```
