-
Exclude last word from a sentence.
Hi guys, I’m working on a sport template based on .csv files.
In the .csv’s file I have many player’s names in “SURNAME NAME” format that I need to transform in (at least) SURNAME format (even better would be the SURNAME N. format)
I’ve tried the following expression:
text_array1 = thisComp.layer("\\FILENAME.csv")("Data")("Outline")("\\PLAYER")("\\PLAYER0").toUpperCase().split(" ");
try
{
text_array1[1]+" "+ text_array1[2];
}
catch(e) { text_array1[0]; }that it’s the reverse of what I want (it takes only the first word of the sentence) but, anyways, it works well with one word surnames.
The issue is with the double word surnames when the expression only give me the first part of surname (ex. SUR SURNAME only give me SUR) , so I’m asking myself if there is a way to reach the final result I want.