Expand my Community achievements bar.

The next phase for Workfront Community ideas is coming soon. Learn all about it in our blog!

Split a string where there are spaces, put it into an array and then get the first and last items in the array (get a fistname and lastname variables from the string "John Smith")

Avatar

Level 3

I guess what I want to do is fairly simple but can't figure out how to do it and there is not much documentation with examples to help me out.

 

I want to take the string "John Smith" and split it at the space and create two variables

1) firstName: John

2) lastName: Smith

 

cannot fot the lifge of me figure out how to get this to work. Have tried splitting the string then using get to pull out the first and last items in the array but to no avail. Any help is much appreciated.

 

Thanks

1 Reply

Avatar

Community Advisor

If you are still trying to figure this out, here is how I would approach it.

1. Create a variable, {name array}, that has split({name};{space}), make sure you select the "space" keyword from the string tab

2. Create a variable for the first name, get({name array};1)

3. Create a variable for the last name, get(reverse({name});1)