# Sort Lines by Number Prefix or Suffix

> Sort lines of text by the number at the beginning or end of each line.

- ID: `sort_lines_by_number_prefix`
- Type: Block
- Category: [Strings](https://inventor.bot/docs/reference/blocks/strings.md)

- Value block: it can be used directly inside expressions, e.g. `"Result: " + sort_lines_by_number_prefix(Args{...})`.

**Inputs**

| Name | Required | Description | Value |
| --- | --- | --- | --- |
| `text` | yes | Text with lines to sort. |  |
| `order` | yes | Ascending or descending. | `"Ascending"`, `"Descending"` |
| `number_placement` | yes | Where in each line the number is placed. | `"Start"`, `"End"` |
| `newline_delimiter` |  | Delimiter separating lines. Defaults to \n. | e.g. `"\\n"` |

**Outputs**

| Name | Description | Value |
| --- | --- | --- |
| `sorted_text` | Lines sorted by numeric prefix/suffix. |  |

**Example**

```go
sortLinesByNumberPrefix := sort_lines_by_number_prefix(Args{
	text:             "...",
	order:            "Ascending",
	number_placement: "Start",
})
send_text_message(Args{
	channel_id:      trigger.channel_id,
	message_content: "Sorted Text: " + sortLinesByNumberPrefix,
})
```