Small split question

Hi;

A“split” question:

I need to split the following “2010 - trmlo202010 - 21 - 23” and the output should be “trmlo202010 - 21 - 23”. If i split on “-” with index 1, I only get the ‘trmlo202010’ part. Also it is variable, I know there will be at least 1 “-” and I need to get the string after this first “-”.

Few examples:
Input “2010 - trmlo202010 - 21 - 23” with expected output “trmlo202010 - 21 - 23”
Input “2020 - AbCD202010 - 22 -24 - 27 - 23" with expected output “AbCD202010 - 22 -24 - 27 - 23”

Thanks

try this:
String1 = “2010 - trmlo202010 - 21 - 23”
String2 = Left(String1,4)

image

This will give flexibility on separator value what ever the year it is in the beginning of the string.
Hope my inputs are useful.

Thanks, seems usefull. However, I can not find the activity. Which package is this?

image

1 Like

Capture

Please load package…

1 Like

Hi,

other solution would be to limit the number split occurences:

inputStr.Split({"-"}, 2, Nothing).Last.ToString

Will split on only the first occurence of “-” and return the second part (.Last) as a string.

br,
Topi

1 Like

@rkelchuri and @topi,

Thanks,

both work fine!

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