Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Community is experiencing an influx of spam. As we work toward a solution, please use the 'Notify Moderator' option on the ellipsis menu to flag inappropriate posts.
Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

Remove all content after FIRST special character

LiamC
5 - Atom

Hi All,

 

I am trying to remove all content after the first special character (there are several '-' included in each string). For example:


6 - Craft Workers (EE - US-United States of America)

 

1.2 - Mid-Level (EE - IE-Ireland)

 

4 - Sales (EE - CA -Canada)

 

I just want to extract everything before the first dash.

 

Thank you for your help with this!

3 REPLIES 3
messi007
15 - Aurora
15 - Aurora

@LiamC,

 

Please see below:

 

messi007_0-1610013457452.png

 

Attached the workflow,

 

If this solves your issue please mark the answer as correct, it will help others!

Regards,

Qiu
21 - Polaris
21 - Polaris

@LiamC 
It is easier when you say first Dash character.

 

Returns the 0-based index of the first occurrence of (Target) in (String). Returns -1 if no occurrence.



0107-LiamC.PNG

pedrodrfaria
13 - Pulsar

Hi @LiamC 

 

As @Qiu and @messi007  showed, you actually have many different ways of doing it. Text to Columns, Left + findstring function, substring function, even Regex if you feel like having some nerdy fun, etc..

 

I added below an example using the substring function:

 

pedrodrfaria_0-1610022239426.png

 

Pedro.

 

Labels
Top Solution Authors