Skip to content

Commit 2117e90

Browse files
Add char_length and character_length functions (#748)
Add docs for the new size(STRING) aliases --------- Co-authored-by: Jens Pryce-Åklundh <[email protected]>
1 parent 8d71dab commit 2117e90

File tree

3 files changed

+163
-0
lines changed

3 files changed

+163
-0
lines changed

modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,30 @@ a|
8888
label:functionality[]
8989
label:new[]
9090

91+
[source, cypher, role=noheader]
92+
----
93+
RETURN char_length(expr)
94+
----
95+
96+
| Introduction of a xref::functions/scalar.adoc#functions-char_length[char_length()] function.
97+
This function returns the number of Unicode characters in a `STRING`. It is an alias of the xref::functions/scalar.adoc#functions-size[`size()`] function.
98+
99+
a|
100+
label:functionality[]
101+
label:new[]
102+
103+
[source, cypher, role=noheader]
104+
----
105+
RETURN character_length(expr)
106+
----
107+
108+
| Introduction of a xref::functions/scalar.adoc#functions-character_length[character_length()] function.
109+
This function returns the number of Unicode characters in a `STRING`. It is an alias of the xref::functions/scalar.adoc#functions-size[`size()`] function.
110+
111+
a|
112+
label:functionality[]
113+
label:new[]
114+
91115
New privilege:
92116
[source, cypher, role=noheader]
93117
----

modules/ROOT/pages/functions/index.adoc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,15 @@ These functions return a single value.
9191
|===
9292
| Function | Signature | Description
9393

94+
1.1+| xref::functions/scalar.adoc#functions-char_length[`char_length()`]
95+
| `char_length(input :: STRING) :: INTEGER`
96+
| Returns the number of Unicode characters in a `STRING`.
97+
label:new[Introduced in 5.13]
98+
99+
1.1+| xref::functions/scalar.adoc#functions-character_length[`character_length()`]
100+
| `character_length(input :: STRING) :: INTEGER`
101+
| Returns the number of Unicode characters in a `STRING`.
102+
label:new[Introduced in 5.13]
94103
1.1+| xref::functions/scalar.adoc#functions-coalesce[`coalesce()`]
95104
| `coalesce(input :: ANY) :: ANY`
96105
| Returns the first non-null value in a list of expressions.

modules/ROOT/pages/functions/scalar.adoc

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,136 @@ CREATE
3434
////
3535

3636

37+
[[functions-char_length]]
38+
== char_length()
39+
40+
_This feature was introduced in Neo4j 5.13._
41+
42+
The function `char_length()` returns the number of Unicode characters in a `STRING`.
43+
This function is an alias of the xref::functions/scalar.adoc#functions-size[`size()`] function.
44+
45+
*Syntax:*
46+
47+
[source, syntax, role="noheader"]
48+
----
49+
char_length(string)
50+
----
51+
52+
*Returns:*
53+
54+
|===
55+
56+
| `INTEGER`
57+
58+
|===
59+
60+
*Arguments:*
61+
62+
[options="header"]
63+
|===
64+
| Name | Description
65+
66+
| `string`
67+
| An expression that returns a `STRING`.
68+
69+
|===
70+
71+
*Considerations:*
72+
|===
73+
74+
| `char_length(null)` returns `null`.
75+
76+
|===
77+
78+
79+
.+char_length()+
80+
======
81+
82+
.Query
83+
[source, cypher, indent=0]
84+
----
85+
RETURN char_length('Alice')
86+
----
87+
88+
.Result
89+
[role="queryresult",options="header,footer",cols="1*<m"]
90+
|===
91+
92+
| +char_length('Alice')+
93+
| +5+
94+
1+d|Rows: 1
95+
96+
|===
97+
98+
The number of Unicode characters in the string is returned.
99+
100+
======
101+
102+
[[functions-character_length]]
103+
== character_length()
104+
105+
_This feature was introduced in Neo4j 5.13._
106+
107+
The function `character_length()` returns the number of Unicode characters in a `STRING`.
108+
This function is an alias of the xref::functions/scalar.adoc#functions-size[`size()`] function.
109+
110+
*Syntax:*
111+
112+
[source, syntax, role="noheader"]
113+
----
114+
character_length(string)
115+
----
116+
117+
*Returns:*
118+
119+
|===
120+
121+
| `INTEGER`
122+
123+
|===
124+
125+
*Arguments:*
126+
127+
[options="header"]
128+
|===
129+
| Name | Description
130+
131+
| `string`
132+
| An expression that returns a `STRING`.
133+
134+
|===
135+
136+
*Considerations:*
137+
|===
138+
139+
| `character_length(null)` returns `null`.
140+
141+
|===
142+
143+
144+
.+character_length()+
145+
======
146+
147+
.Query
148+
[source, cypher, indent=0]
149+
----
150+
RETURN character_length('Alice')
151+
----
152+
153+
.Result
154+
[role="queryresult",options="header,footer",cols="1*<m"]
155+
|===
156+
157+
| +character_length('Alice')+
158+
| +5+
159+
1+d|Rows: 1
160+
161+
|===
162+
163+
The number of Unicode characters in the string is returned.
164+
165+
======
166+
37167
[[functions-coalesce]]
38168
== coalesce()
39169

0 commit comments

Comments
 (0)