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

[doc]Fix string function documentation docs #1842

Merged
merged 6 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ The COUNT_SUBSTRINGS function counts the number of occurrences of a specified su
## Syntax

```sql
COUNT_SUBSTRINGS(str, pattern)
COUNT_SUBSTRINGS(VARCHAR <str>, VARCHAR <pattern>)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

参数不需要类型说明

Suggested change
COUNT_SUBSTRINGS(VARCHAR <str>, VARCHAR <pattern>)
COUNT_SUBSTRINGS(<str>, <pattern>)

```

## Parameters
| Parameter | Description |
| --------- | --------------------------------------- |
| str | The string to be searched. Type: STRING |
| pattern | The substring to match. Type: STRING |
| `<str>` | The string to be searched. Type: STRING |
| `<pattern>` | The substring to match. Type: STRING |

## Return Value

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ The CUT_TO_FIRST_SIGNIFICANT_SUBDOMAIN function extracts the effective part of a
## Syntax

```sql
VARCHAR CUT_TO_FIRST_SIGNIFICANT_SUBDOMAIN(VARCHAR url)
CUT_TO_FIRST_SIGNIFICANT_SUBDOMAIN(VARCHAR <url>)
```

## Parameters
| Parameter | Description |
| --------- | --------------------------------------------- |
| url | The URL string to be processed. Type: VARCHAR |
| `<url>` | The URL string to be processed. Type: VARCHAR |

## Return Value

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ The key feature of LTRIM_IN is that it removes any combination of characters fro
## Syntax

```sql
VARCHAR LTRIM_IN(VARCHAR str[, VARCHAR rhs])
LTRIM_IN(VARCHAR <str> [, VARCHAR <rhs>])
```

## Parameters
| Parameter | Description |
| --------- | ---------------------------------------------------------------------- |
| str | The string to be processed. Type: VARCHAR |
| rhs | Optional parameter, the set of characters to be removed. Type: VARCHAR |
| `<str>` | The string to be processed. Type: VARCHAR |
| `<rhs>` | Optional parameter, the set of characters to be removed. Type: VARCHAR |

## Return Value

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ The key feature of RTRIM_IN is that it removes any combination of characters fro
## Syntax

```sql
VARCHAR RTRIM_IN(VARCHAR str[, VARCHAR rhs])
RTRIM_IN(VARCHAR <str> [, VARCHAR <rhs>])
```

## Parameters
| Parameter | Description |
| --------- | ---------------------------------------------------------------------- |
| str | The string to be processed. Type: VARCHAR |
| rhs | Optional parameter, the set of characters to be removed. Type: VARCHAR |
| `<str>` | The string to be processed. Type: VARCHAR |
| `<rhs>` | Optional parameter, the set of characters to be removed. Type: VARCHAR |

## Return Value

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ The STARTS_WITH function checks if a string starts with a specified prefix. Retu
## Syntax

```sql
BOOLEAN STARTS_WITH(VARCHAR str, VARCHAR prefix)
STARTS_WITH(VARCHAR <str>, VARCHAR <prefix>)
```

## Parameters
| Parameter | Description |
| --------- | ----------------------------------------- |
| str | The string to check. Type: VARCHAR |
| prefix | The prefix string to match. Type: VARCHAR |
| `<str>` | The string to check. Type: VARCHAR |
| `<prefix>` | The prefix string to match. Type: VARCHAR |

## Return Value

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ The STRCMP function compares two strings lexicographically. It returns an intege
## Syntax

```sql
TINYINT STRCMP(VARCHAR str0, VARCHAR str1)
STRCMP(VARCHAR <str0>, VARCHAR <str1>)
```

## Parameters
| Parameter | Description |
| -- | -- |
| str0 | The first string to compare. Type: VARCHAR |
| str1 | The second string to compare. Type: VARCHAR |
| `<str0>` | The first string to compare. Type: VARCHAR |
| `<str1>` | The second string to compare. Type: VARCHAR |

## Return Value

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ LEFT
## Syntax

```sql
VARCHAR STRLEFT(VARCHAR str, INT len)
STRLEFT(VARCHAR <str>, INT <len>)
```

## Parameters
| Parameter | Description |
| --------- | --------------------------------------------- |
| str | The string to extract from. Type: VARCHAR |
| len | The number of characters to return. Type: INT |
| `<str>` | The string to extract from. Type: VARCHAR |
| `<len>` | The number of characters to return. Type: INT |

## Return Value

Expand All @@ -60,11 +60,11 @@ Special cases:
SELECT strleft('Hello doris', 5);
```
```text
+------------------------+
+---------------------------+
| strleft('Hello doris', 5) |
+------------------------+
| Hello |
+------------------------+
+---------------------------+
| Hello |
+---------------------------+
```

2. Handling negative length
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ RIGHT
## Syntax

```sql
VARCHAR STRRIGHT(VARCHAR str, INT len)
STRRIGHT(VARCHAR <str>, INT <len>)
```

## Parameters
| Parameter | Description |
| --------- | --------------------------------------------- |
| str | The string to extract from. Type: VARCHAR |
| len | The number of characters to return. Type: INT |
| `<str>` | The string to extract from. Type: VARCHAR |
| `<len>` | The number of characters to return. Type: INT |

## Return Value

Expand All @@ -61,45 +61,45 @@ Special cases:
SELECT strright('Hello doris', 5);
```
```text
+-------------------------+
+----------------------------+
| strright('Hello doris', 5) |
+-------------------------+
| doris |
+-------------------------+
+----------------------------+
| doris |
+----------------------------+
```

2. Handling negative length
```sql
SELECT strright('Hello doris', -7);
```
```text
+--------------------------+
+-----------------------------+
| strright('Hello doris', -7) |
+--------------------------+
| doris |
+--------------------------+
+-----------------------------+
| doris |
+-----------------------------+
```

3. Handling NULL parameter
```sql
SELECT strright('Hello doris', NULL);
```
```text
+----------------------------+
+-------------------------------+
| strright('Hello doris', NULL) |
+----------------------------+
| NULL |
+----------------------------+
+-------------------------------+
| NULL |
+-------------------------------+
```

4. Handling NULL string
```sql
SELECT strright(NULL, 5);
```
```text
+----------------+
+-------------------+
| strright(NULL, 5) |
+----------------+
| NULL |
+----------------+
+-------------------+
| NULL |
+-------------------+
```
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ The SUBSTRING_INDEX function is used to extract a substring from a string based
## Syntax

```sql
VARCHAR SUBSTRING_INDEX(VARCHAR content, VARCHAR delimiter, INT field)
SUBSTRING_INDEX(VARCHAR <content>, VARCHAR <delimiter>, INT <field>)
```

## Parameters
| Parameter | Description |
| --------- | --------------------------------------------------------------------------------------------------------------- |
| content | The string to be extracted from. Type: VARCHAR |
| delimiter | The delimiter string, case-sensitive and multi-byte safe. Type: VARCHAR |
| field | Number of delimiter occurrences. Positive numbers count from left, negative numbers count from right. Type: INT |
| `<content>` | The string to be extracted from. Type: VARCHAR |
| `<delimiter>` | The delimiter string, case-sensitive and multi-byte safe. Type: VARCHAR |
| `<field>` | Number of delimiter occurrences. Positive numbers count from left, negative numbers count from right. Type: INT |

Note: The delimiter and field parameters must be constants, variables are not supported.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ SUBSTR
## Syntax

```sql
VARCHAR SUBSTRING(VARCHAR str, INT pos [, INT len])
SUBSTRING(VARCHAR <str>, INT <pos> [, INT <len>])
```

## Parameters
| Parameter | Description |
| --------- | ------------------------------------------------ |
| str | Source string. Type: VARCHAR |
| pos | Starting position, can be negative. Type: INT |
| len | Optional parameter, length to extract. Type: INT |
| `<str>` | Source string. Type: VARCHAR |
| `<pos>` | Starting position, can be negative. Type: INT |
| `<len>` | Optional parameter, length to extract. Type: INT |

## Return Value

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ The TO_BASE64 function is used to convert an input string to Base64 encoded form
## Syntax

```sql
VARCHAR TO_BASE64(VARCHAR str)
TO_BASE64(VARCHAR <str>)
```

## Parameters
| Parameter | Description |
| --------- | ---------------------------------------------- |
| str | The string to be Base64 encoded. Type: VARCHAR |
| `<str>` | The string to be Base64 encoded. Type: VARCHAR |

## Return Value

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ The TOP_LEVEL_DOMAIN function is used to extract the top-level domain from a URL
## Syntax

```sql
VARCHAR TOP_LEVEL_DOMAIN(VARCHAR url)
TOP_LEVEL_DOMAIN(VARCHAR <url>)
```

## Parameters
| Parameter | Description |
| --------- | ------------------------------------------------------------------------ |
| url | The URL string from which to extract the top-level domain. Type: VARCHAR |
| `<url>` | The URL string from which to extract the top-level domain. Type: VARCHAR |

## Return Value

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ The TRANSLATE function is used for string replacement, converting characters in
## Syntax

```sql
VARCHAR TRANSLATE(VARCHAR source, VARCHAR from, VARCHAR to)
TRANSLATE(VARCHAR <source>, VARCHAR <from>, VARCHAR <to>)
```

## Parameters
| Parameter | Description |
| --------- | --------------------------------------------------- |
| source | The source string to be converted. Type: VARCHAR |
| from | The set of characters to be replaced. Type: VARCHAR |
| to | The set of replacement characters. Type: VARCHAR |
| `<source>` | The source string to be converted. Type: VARCHAR |
| `<from>` | The set of characters to be replaced. Type: VARCHAR |
| `<to>` | The set of replacement characters. Type: VARCHAR |

## Return Value

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ The key feature of TRIM_IN is that it removes any combination of characters from
## Syntax

```sql
VARCHAR trim_in(VARCHAR str[, VARCHAR rhs])
TRIM_IN(VARCHAR <str> [, VARCHAR <rhs>])
```

## Parameters
| Parameter | Description |
| --------- | ---------------------------------------------------------------------- |
| str | The string to be processed. Type: VARCHAR |
| rhs | Optional parameter, the set of characters to be removed. Type: VARCHAR |
| `<str>` | The string to be processed. Type: VARCHAR |
| `<rhs>` | Optional parameter, the set of characters to be removed. Type: VARCHAR |

## Return Value

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ COUNT_SUBSTRINGS 函数用于计算一个字符串中指定子串出现的次数
## 语法

```sql
COUNT_SUBSTRINGS(str, pattern)
COUNT_SUBSTRINGS(<str>, <pattern>)
```

## 参数
| 参数 | 说明 |
| ------- | ------------------------------ |
| str | 需要检测的字符串。类型:STRING |
| pattern | 需要匹配的子串。类型:STRING |
| `<str>` | 需要检测的字符串。类型:STRING |
| `<pattern>` | 需要匹配的子串。类型:STRING |

## 返回值

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ CUT_TO_FIRST_SIGNIFICANT_SUBDOMAIN 函数用于从 URL 中提取域名的有效
## 语法

```sql
VARCHAR CUT_TO_FIRST_SIGNIFICANT_SUBDOMAIN(VARCHAR url)
CUT_TO_FIRST_SIGNIFICANT_SUBDOMAIN(VARCHAR <url>)
```

## 参数
| 参数 | 说明 |
| ---- | ------------------------------------ |
| url | 需要处理的 URL 字符串。类型:VARCHAR |
| `<url>` | 需要处理的 URL 字符串。类型:VARCHAR |

## 返回值

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ LTRIM_IN 的特点是会移除指定字符集合中的任意字符组合,而 L
## 语法

```sql
VARCHAR LTRIM_IN(VARCHAR str[, VARCHAR rhs])
LTRIM_IN(VARCHAR <str>[, VARCHAR <rhs>])
```

## 参数
| 参数 | 说明 |
| ---- | ----------------------------------------- |
| str | 需要处理的字符串。类型:VARCHAR |
| rhs | 可选参数,要移除的字符集合。类型:VARCHAR |
| `<str>` | 需要处理的字符串。类型:VARCHAR |
| `<rhs>` | 可选参数,要移除的字符集合。类型:VARCHAR |

## 返回值

Expand Down
Loading