Select to view content in your preferred language

How to split string after first word

2979
2
Jump to solution
08-03-2020 04:28 AM
LiorHershkovitz
New Contributor II

Hi, 

I have a filed of trees botanical name, now I have to separate it to Genus field and Species field.

Which means I have to extract the first word (Genus) and the second one (Species).

Something like text to column in Excel

Using arcgis pro or online

Thanks!

Lior

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
Egge-Jan_Pollé
MVP Regular Contributor

Hi Lior Hershkovitz,

I guess you are going to use the ArcGIS Arcade expression language to get this done.

You can test this simple script in the ArcGIS Arcade Playground:

var tree = "Prunus virginiana";
var sepValues = Split(tree, ' ');
// return sepValues[0]; // Genus - Result: Prunus
return sepValues[1]; // Species - Result: virginiana

Let's suppose your column with tree names is called TREE. To apply this split on the whole column at once, you can use:

Split($feature.TREE, ' ')[0] // Genus

and

Split($feature.TREE, ' ')[1] // Species

HTH,

Egge-Jan

View solution in original post

2 Replies
Egge-Jan_Pollé
MVP Regular Contributor

Hi Lior Hershkovitz,

I guess you are going to use the ArcGIS Arcade expression language to get this done.

You can test this simple script in the ArcGIS Arcade Playground:

var tree = "Prunus virginiana";
var sepValues = Split(tree, ' ');
// return sepValues[0]; // Genus - Result: Prunus
return sepValues[1]; // Species - Result: virginiana

Let's suppose your column with tree names is called TREE. To apply this split on the whole column at once, you can use:

Split($feature.TREE, ' ')[0] // Genus

and

Split($feature.TREE, ' ')[1] // Species

HTH,

Egge-Jan

LiorHershkovitz
New Contributor II

Thanks!

in online, I made calculate field with the expression you wrote.

You are the man!