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

# strleft

> 从字符串左侧返回指定长度的字符，是left函数的别名。

从字符串左边部分返回指定长度的字符，长度的单位为「utf8 字符」。函数别名为 [left](/documents/cn/4.2/sql-reference/sql-functions/string-functions/left.md).

## 语法

```Haskell theme={null}
VARCHAR strleft(VARCHAR str, INT len)
```

## 参数说明

`str`: 待处理的字符串，支持的数据类型为 VARCHAR。

`len`: 要返回的字符长度，支持的数据类型为 INT。

## 返回值说明

返回值的数据类型为 VARCHAR。

## 示例

```Plain Text theme={null}
MySQL > select strleft("Hello starrocks",5);
+-----------------------------+
|strleft('Hello starrocks', 5)|
+-----------------------------+
| Hello                       |
+-----------------------------+
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.