Neo4j - Substring Function


It takes a string as an input and two indexes: one is the start of the index and another is the end of the index and returns a substring from Start Index to End Index-1. All CQL Functions should use "( )" brackets.

Syntax

Following is the syntax of the function SUBSTRING() in Neo4j.

LOWER (<input-string>) 

Example

Following is a sample Cypher query which demonstrates the usage of the function SUBSTRING() in Neo4j. Here, we are trying get the substring of the names of all the players.

MATCH (n:player)  
RETURN SUBSTRING(n.name,0,5), n.YOB, n.POB

To execute the above query, carry out the following steps −

Step 1 − Open the Neo4j desktop App and start the Neo4j Server. Open the built-in browser app of Neo4j using the URL http://localhost:7474/ as shown in the following screenshot.

Browser App

Step 2 − Copy and paste the desired query in the dollar prompt and press the play button (to execute the query) highlighted in the following screenshot.

Substring Return

Result

On executing, you will get the following result.

Substring Result
neo4j_string_functions.htm
Advertisements