How to split string and get text

I want to split the string and want to get the specific text length.
Below is the string.
124-SYS-RLAKS-0306101135P-System Maintenance
And I want to get the string as.
124-SYS-RLAKS-0306101135P

I want get the text after except last hyphen.

I tried below activity.

image

@nilesh.mahajan

Check as below

Mark as solution if this helps

Thanks

Hi @nilesh.mahajan,
If this(-System Maintenance) is always same and never change then replace that with an empty value like this outvar= inputvar.Replace("-System Maintenance",string.Empty).ToString

Regards,
Aditya

Hi @nilesh.mahajan

Below is the workflow for the same :-
MainPratik.xaml (7.0 KB)

str.ToString.Substring(0,(str.ToString.IndexOf(str.ToString.Split("-"c)(str.ToString.Length-str.ToString.Replace("-","").Length)))-1)

Output :-

Mark as solution and like it :slight_smile:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

3 Likes

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