Ilnaz Nikseresht
Ilnaz Nikseresht

Reputation: 31

How does cypher ignore the space in CSV format?

I need to make a graph of the CSV file information with the SourceIP, DestinationIP, Timestamp. But the issue is that there is a space before each of the SourceIP, DestinationIP and Timestamp(first line only). I wrote below query which works fine where there is no space. Can anyone help me with ignoring the space?

LOAD CSV WITH HEADERS FROM 'file:/netflow1.csv' AS row 
WITH row WHERE row.SourceIP IS NOT NULL 
MERGE(source:m {Name:row.SourceIP})
MERGE(dest:n {Name:row.DestinationIP})
MERGE(source)-[r:To{Timestamp:row.Timestamp}]->(Dest)
WITH source,dest,row
MATCH(n) RETURN n

Upvotes: 0

Views: 106

Answers (1)

jose_bacoy
jose_bacoy

Reputation: 12684

There is string function that removes space(s) before and after the original string.

https://neo4j.com/docs/cypher-manual/current/functions/string/#functions-trim

trim('str')

For example: RETURN trim('   hello   ')  will return "hello"

Upvotes: 1

Related Questions