Standarizing a String by clearing a portion of it

I would like to change this AAAA / BBBB /CCCC / DDDD pattern to this: BBBB / CCCC / DDDD

for exemple an adress like: Daniel Boone / 8888 Riverview Dr / Calgary / CA
to 8888 Riverview Dr / Calgary / CA

Any help ? Thanks in advance

Use Split on /

1 Like

Hi @Woodson_Louis

How about the following?
image
image

String.Join("/", strInput.Split("/"c).Skip(1).Select(Function(e) e.Trim()))

BTW: if you want with the spaces just remove the .Trim() like this

String.Join("/", strInput.Split("/"c).Skip(1).Select(Function(e) e))

Regards!

1 Like

Hello

You could use a β€˜Regex.Replace’. Match the starting text you need then replace with nothing (β€œβ€).

Insert the following into an assign activity.

Left Assign:
str_Result

Right Assign:
System.Text.RegularExpressions.Regex.Replace(yourStr, β€œ^[\/]+\/\s+”, β€œβ€)

image

image

Preview the link here:

Cheers

Steve

1 Like

Thank you guys for the help @fernando_zuluaga , @Steven_McKeering and @postwick :wink:

1 Like

Hey @Woodson_Louis

Always happy to help :blush:

Cheers

Steve

1 Like

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