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

add-usage-for-length()-and-size() #2312

Merged
merged 1 commit into from
Nov 11, 2022
Merged
Show file tree
Hide file tree
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
14 changes: 11 additions & 3 deletions docs-2.0/3.ngql-guide/6.functions-and-expressions/1.math.md
Original file line number Diff line number Diff line change
Expand Up @@ -554,12 +554,12 @@ nebula> RETURN bit_xor(5,6);

## size()

size() 返回列表或映射中元素的数量。
size() 返回列表或映射中元素的数量,或者返回字符串的长度

语法:`size(<expression>)`
语法:`size({<expression>|<string>})`

- `expression`:列表或映射的表达式。

- `string`:指定的字符串。
- 返回类型:int。

示例:
Expand All @@ -573,6 +573,14 @@ nebula> RETURN size([1,2,3,4]);
+-----------------+
```

```ngql
nebula> RETURN size("basketballplayer") as size;
+------+
| size |
+------+
| 16 |
+------+
```
## range()

range() 返回指定范围(`[start,end]`)中指定步长的值组成的列表。
Expand Down
19 changes: 16 additions & 3 deletions docs-2.0/3.ngql-guide/6.functions-and-expressions/2.string.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,14 @@ nebula> RETURN upper("Basketball_Player");

## length()

length() 返回指定字符串的长度,单位:字节。
length() 返回:
- 指定字符串的长度,单位:字节。
- 路径的长度,单位:跳。

语法:`length(<string>)`
语法:`length({<string>|<path>})`

- `string`:指定的字符串。

- `path`:指定的路径,使用变量表示。
- 返回类型:int。

示例:
Expand All @@ -94,6 +96,17 @@ nebula> RETURN length("basketball");
+----------------------+
```

```ngql
nebula> MATCH p=(v:player{name:"Tim Duncan"})-->(v2) return length(p);
+-----------+
| length(p) |
+-----------+
| 1 |
| 1 |
| 1 |
+-----------+
```

## trim()

trim() 删除指定字符串头部和尾部的空格。
Expand Down