Neo4j – Substring Function

  • Post author:
  • Post category:Neo4j
  • Post comments:0 Comments

It takes a string as 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 to 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.

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.

Result

On executing, you will get the following result.

Leave a Reply