Skip to content

Commit

Permalink
Add docs for new normalize function.
Browse files Browse the repository at this point in the history
  • Loading branch information
gem-neo4j committed Nov 27, 2023
1 parent 6af9e33 commit b971d34
Show file tree
Hide file tree
Showing 3 changed files with 161 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ label:deprecated[]
RETURN 1 as my\u0085identifier
----
a|
The Unicode character \`\u0085` is deprecated for unescaped identifiers and will be considered as a whitespace character in the future.
The Unicode character \`\u0085` is deprecated for unescaped identifiers and will be considered as a whitespace character in the future.
To continue using it, escape the identifier by adding backticks around the identifier.
This applies to all unescaped identifiers in Cypher, such as label expressions, properties, variable names or parameters.
This applies to all unescaped identifiers in Cypher, such as label expressions, properties, variable names or parameters.
In the given example, the quoted identifier would be \`my�identifier`.

a|
Expand Down Expand Up @@ -65,6 +65,27 @@ The following Unicode Characters are deprecated in identifiers:

|===

=== New features

[cols="2", options="header"]
|===
| Feature
| Details

a|
label:functionality[]
label:new[]

[source, cypher, role=noheader]
----
RETURN normalize("string", NFC)
----

| Introduction of a xref::functions/string.adoc#functions-normalize[normalize()] function.
Normalize a `STRING` according to the specified normalization form, which can be of type `NFC`, `NFD`, `NFKC` or `NFKD`.

|===

[[cypher-deprecations-additions-removals-5.14]]
== Neo4j 5.14

Expand Down
6 changes: 6 additions & 0 deletions modules/ROOT/pages/functions/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,12 @@ These functions are used to manipulate strings or to create a string representat
| `ltrim(input :: STRING) :: STRING`
| Returns the given `STRING` with leading whitespace removed.

1.2+| xref::functions/string.adoc#functions-normalize[`normalize()`]
| `normalize(input :: STRING) :: STRING`
| Returns the given `STRING` normalized using the normal form 'NFC'.
| `normalize(input :: STRING, normalForm = NFC :: [NFC, NFD, NFKC, NFKD]) :: STRING`
| Returns the given `STRING` normalized according to the specified normalization form.

1.1+| xref::functions/string.adoc#functions-replace[`replace()`]
| `replace(original :: STRING, search :: STRING, replace :: STRING) :: STRING`
| Returns a `STRING` in which all occurrences of a specified search `STRING` in the given `STRING` have been replaced by another (specified) replacement `STRING`.
Expand Down
132 changes: 132 additions & 0 deletions modules/ROOT/pages/functions/string.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,138 @@ RETURN ltrim(' hello')
======



[[functions-normalize]]
== normalize()

`normalize()` returns the given `STRING` normalized using the `NFC` normalization form.

*Syntax:*

[source, syntax, role="noheader"]
----
normalize(input)
----

*Returns:*

|===

| `STRING`

|===

*Arguments:*

[options="header"]
|===
| Name | Description

| `input`
| An expression that returns a `STRING`.

|===

*Considerations:*

|===

| `normalize(null)` returns `null`.

|===


.+normalize()+
======
.Query
[source, cypher, indent=0]
----
RETURN normalize('\u212B') = '\u00C5' AS result
----
.Result
[role="queryresult",options="header,footer",cols="1*<m"]
|===
| +result+
| +true+
1+d|Rows: 1
|===
======


[[functions-normalize-with-normal-form]]
== normalize(), with specified normal form

`normalize()` returns the given `STRING` normalized using the specified normalization form.
The normalization form can be of type `NFC`, `NFD`, `NFKC` or `NFKD`.

*Syntax:*

[source, syntax, role="noheader"]
----
normalize(input, normalForm)
----

*Returns:*

|===

| `STRING`

|===

*Arguments:*

[options="header"]
|===
| Name | Description

| `input`
| An expression that returns a `STRING`.


| `normalForm`
| A keyword specifying the normal form, can be `NFC`, `NFD`, `NFKC` or `NFKD`.

|===

*Considerations:*

|===

| `normalize(null, null)` returns `null`.
| `normalize(null, NFC)` returns `null`.
| `normalize("hello", null)` returns `null`.

|===


.+normalize()+
======
.Query
[source, cypher, indent=0]
----
RETURN normalize('\uFE64', NFKC) = '\u003C' AS result
----
.Result
[role="queryresult",options="header,footer",cols="1*<m"]
|===
| +result+
| +true+
1+d|Rows: 1
|===
======

[[functions-replace]]
== replace()

Expand Down

0 comments on commit b971d34

Please sign in to comment.