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 30, 2023
1 parent b66a2a3 commit be471b0
Show file tree
Hide file tree
Showing 3 changed files with 161 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,30 @@ New features are added to the language continuously, and occasionally, some feat
This section lists all of the features that have been removed, deprecated, added, or extended in different Cypher versions.
Replacement syntax for deprecated and removed features are also indicated.

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

=== 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.15]]
== Neo4j 5.15

Expand Down Expand Up @@ -92,7 +116,7 @@ label:updated[]
MATCH (n:Label) WHERE $param IS :: STRING NOT NULL AND n.prop = $param
----

| `IS :: STRING NOT NULL` is now an xref:planning-and-tuning/query-tuning/indexes.adoc#text-index-type-predicate-expressions[index-compatible predicate].
| `IS :: STRING NOT NULL` is now an xref:planning-and-tuning/query-tuning/indexes.adoc#text-index-type-predicate-expressions[index-compatible predicate].

|===

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
130 changes: 130 additions & 0 deletions modules/ROOT/pages/functions/string.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,136 @@ 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, NFC)` 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 be471b0

Please sign in to comment.