floor_char_boundary
No overview available.
def floor_char_boundary(
text: string,
index: integer
) - > integer
Adjusts a byte index downward to the nearest valid UTF-8 character boundary. This ensures that slicing operations do not split multi-byte characters, which would result in invalid string data.
Parameters
| Name | Type | Description |
|---|---|---|
| text | string | The source string used to determine character boundaries based on its UTF-8 encoding. |
| index | integer | The initial byte offset into the string that may need adjustment to avoid splitting a character. |
Returns
| Type | Description |
|---|---|
integer | The largest byte index less than or equal to the input index that points to the start of a UTF-8 character. |