Split text (last)

I have value D\yuyu\rtrt\df.xlsx I want get value after \ (last text) —> expect output df.xlsx
D\uyu\uiu\uiui\ui.pdf —> expect output ui.pdf

Please guide me for solve it.

Hi @Stef_99

Try this

Path.GetFileName(Input.ToString)

Cheers!!

1 Like

Hi @Stef_99

fullPath.Substring(fullPath.LastIndexOf("\") + 1)

Hope it helps!!

1 Like

@Stef_99

Cheers!!

1 Like

Hi @Stef_99

You can try the below expression by using the Data Manipulations Split Function,

- Assign -> Input = "D\yuyu\rtrt\df.xlsx"
- Assign -> Output = Input.Split("\").last.toString

The Output Variable stores the df.xlsx.

Hope it helps!!

1 Like

If you want to split text, have you tried the activity called “Split Text”? It splits text into a list of strings. Then you can get the last one like output(output.count-1)

Other approaches do work, but you should use the correct activities whenever possible.

1 Like

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