Split string starting at the end of the string

Hello, i want to take a string like the example below:

[EXTERNAL] Training Complete: BOSS Advanced Curriculum for employee - 012345

i want to start at the end and split at the employee id. Was trying to read through the forum before i posted but could not find out how to start at the end of the string to grab what i need. the reason for starting at the end is that the word “employee” here will actually have the employee’s name so the number of characters will always be different leading up to the employee id.

Hi @chris.dease

Your query is some what confusing, could you be more elaborate your query and provide the input and required output for our reference.

If you want to get the Employee ID only then you can use simple split function for this,

- Assign -> Input = "[EXTERNAL] Training Complete: BOSS Advanced Curriculum for employee - 012345"
- Assign -> Output = Input.toString.Split("-")(1).Trim

Hope it helps!!

Hi @chris.dease

Input.Substring(Input.LastIndexOf("- ") + 2)

@chris.dease

Str.Split("-"c).Last will give the last string after hyphen

Cheers

this was helpful. i just realized after posting i could split and the hyphen instead of starting at end of string. thanks!!

1 Like

It’s my pleasure… @chris.dease

Happy Automation!!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.