morrySnow commented on code in PR #1860: URL: https://github.com/apache/doris-website/pull/1860#discussion_r1920459075
########## docs/sql-manual/sql-functions/scalar-functions/conditional-functions/not-null-or-empty.md: ########## @@ -24,37 +24,58 @@ specific language governing permissions and limitations under the License. --> -## not_null_or_empty -### description -#### Syntax +## Description -`BOOLEAN NOT_NULL_OR_EMPTY (VARCHAR str)` +The `not_null_or_empty` function checks if the given value is neither NULL nor empty. It returns true if the input value is not NULL and not an empty string, otherwise, it returns false. -It returns false if the string is an empty string or NULL. Otherwise it returns true. +## Syntax -### example +`NOT_NULL_OR_EMPTY (<str>)` Review Comment: 使用code block 而不是 inline code ````suggestion ```sql NOT_NULL_OR_EMPTY (<str>) ``` ```` ########## i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/string-functions/sub-replace.md: ########## @@ -22,31 +22,49 @@ specific language governing permissions and limitations under the License. --> -## sub_replace + ## 描述 + +`sub_replace` 函数用于替换字符串中的子字符串。可以指定要替换的子字符串和替换的目标字符串,返回用`new_str` 字符串替换 `str` 中从 `start` 开始长度为len的新字符串。其中 `start`, `len` 为负整数,返回 NULL, 且 `len` 的默认值为 `new_str` 的长度。 + ## 语法 -`VARCHAR sub_replace(VARCHAR str, VARCHAR new_str, INT start[, INT len])` +`VARCHAR sub_replace(<str>, <new_str>, <start[, len]>)` + +## 参数 + +| 参数 | 说明 | +| -- | -- | +| `<str>` | 要进行替换操作的目标字符串 | +| `<new_str>` | 用于替换的目标字符串 | +| `<start[, len]>` | start 表示替换操作开始的位置,可选参数,表示要替换的子字符串长度 | Review Comment: start 和 len 是两个参数吧? start 和 len 都可选吗?如果是的话应该是 `[ ,<start> [ , <len> ] ]` 如果只有 len 可选,应该是 `,<start> [ , <len> ]` ########## docs/sql-manual/sql-functions/scalar-functions/string-functions/sub-replace.md: ########## @@ -22,32 +22,48 @@ specific language governing permissions and limitations under the License. --> -## sub_replace -### Description -#### Syntax +## Description -`VARCHAR sub_replace(VARCHAR str, VARCHAR new_str, INT start[, INT len])` +The `sub_replace` function is used to replace substrings within a string. You can specify the substring to be replaced and the target string to replace it with. It returns a new string where the substring starting from `start` with length `len` in `str` is replaced by `new_str`. If `start` or `len` is a negative integer, it returns NULL. The default value for `len` is the length of `new_str`. -Return with new_str replaces the str with length and starting position from start. -When start and len are negative integers, return NULL. -and the default value of len is the length of new_str. +## Syntax -### example +`VARCHAR sub_replace(<str>, <new_str>, <start[, len]>)` Review Comment: 不要带类型 ````suggestion ```sql sub_replace(<str>, <new_str>, <start> [, <len> ]) ``` ```` ########## i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-functions/scalar-functions/string-functions/sub-replace.md: ########## @@ -22,31 +22,49 @@ specific language governing permissions and limitations under the License. --> -## sub_replace + ## 描述 + +`sub_replace` 函数用于替换字符串中的子字符串。可以指定要替换的子字符串和替换的目标字符串,返回用`new_str` 字符串替换 `str` 中从 `start` 开始长度为len的新字符串。其中 `start`, `len` 为负整数,返回 NULL, 且 `len` 的默认值为 `new_str` 的长度。 + ## 语法 -`VARCHAR sub_replace(VARCHAR str, VARCHAR new_str, INT start[, INT len])` +`VARCHAR sub_replace(<str>, <new_str>, <start[, len]>)` + +## 参数 + +| 参数 | 说明 | +| -- | -- | +| `<str>` | 要进行替换操作的目标字符串 | +| `<new_str>` | 用于替换的目标字符串 | +| `<start[, len]>` | start 表示替换操作开始的位置,可选参数,表示要替换的子字符串长度 | + +## 返回值 -返回用new_str字符串替换str中从start开始长度为len的新字符串。 -其中start,len为负整数,返回NULL, 且len的默认值为new_str的长度。 +返回替换后的字符串。 ## 举例 ``` -mysql> select sub_replace("this is origin str","NEW-STR",1); +select sub_replace("this is origin str","NEW-STR",1); Review Comment: 最好参数中间能加一些空格,提升阅读便捷程度 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org