Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

string-functions: update ASCII() and BIN() #16120

Merged
merged 1 commit into from
Jan 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions functions-and-operators/string-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ TiDB 支持使用大部分 MySQL 5.7 中提供的[字符串函数](https://dev.m
`ASCII()` 函数用于获取输入的参数中最左字符的 ASCII 值。该参数可以为字符串或数字。

- 如果输入参数不为空,该函数返回参数中最左字符的 ASCII 值。
- 如果输入参数为空,该函数返回 `0`。
- 如果输入参数为空字符串,该函数返回 `0`。
- 如果输入参数为 `NULL`,该函数返回 `NULL`。

> **注意:**
Expand Down Expand Up @@ -63,7 +63,7 @@ SELECT ASCII(23);
- 如果输入参数为负数,该函数会将该参数的绝对值转换为其二进制值,然后对二进制值的每位取反(`0` 变为 `1`,`1` 变为 `0`),最后加上 `1`。
- 如果输入参数为字符串,且该字符串中只包含数字,该函数将按照该数字返回结果。例如,`"123"` 与 `123` 的返回结果相同。
- 如果输入参数为字符串,且该字符串第一个字符不是数字(如 `"q123"`),该函数返回 `0`。
- 如果输入参数为字符串,且该字符串由数字和非数字组成,该函数将按照该参数中最前面连续的数字返回结果。例如,`123q123` 与 `123` 的返回结果相同。
- 如果输入参数为字符串,且该字符串由数字和非数字组成,该函数将按照该参数中最前面连续的数字返回结果。例如,`"123q123"` 与 `123` 的返回结果相同。
- 如果输入参数为 `NULL`,该函数返回 `NULL`。

示例:
Expand Down