Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
06-21-2019 07:29 AM
Hi guys,
Id like to split the following csv column into 2. The split being between the first 2 charactors e.g the first one would split into LA and 05
St/Dis (Header)
LA05
NC12
AL04
CA31
GA12
TX32
MI03
NV02
ND00
Kind regards,
Sam
Solved! Go to Solution.
06-21-2019 07:38 AM
If your field is only 4 characters, the easiest way would be to use left()
and right()
to get the leftmost and rightmost characters:
... //assume row is the variable from LOAD CSV
WITH row, left(row.`St/Dis`, 2) as state, right(row.`St/Dis`, 2) as dis
...
If the Dis
part can be more than two characters, then you'll want to use substring() instead like Dana suggested:
substring(row.`St/Dis`, 2) as dis
06-21-2019 07:36 AM
not exactly sure if you are simply wanting to split the data in CSV file itself and rewrite the file or if u want to read the data and then split based upon the 1st 2 characters using a Cypher statement but this should be possible via the SUBTRING() function
06-21-2019 07:38 AM
If your field is only 4 characters, the easiest way would be to use left()
and right()
to get the leftmost and rightmost characters:
... //assume row is the variable from LOAD CSV
WITH row, left(row.`St/Dis`, 2) as state, right(row.`St/Dis`, 2) as dis
...
If the Dis
part can be more than two characters, then you'll want to use substring() instead like Dana suggested:
substring(row.`St/Dis`, 2) as dis
06-21-2019 07:39 AM
brillant thanks lads
All the sessions of the conference are now available online