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.
SOLVED

Add WhiteSpaces after Uppercase letter

beatrizmguerreiro
8 - Asteroid

Hello, 

 

I have the below example:

 

NiceToMeetYou

 

However, I need to separate each word, by adding white spaces, so the output = Nice To Meet You.

 

Can somebody help me?

 

3 REPLIES 3
Kenda
16 - Nebula
16 - Nebula

Hi there @beatrizmguerreiro 

 

I would use a bit of RegEx to solve this problem. Simply add a formula tool to your canvas and use the following expression:

trim(REGEX_Replace([Field1], "(\u)", " $1",0))

 

where Field1 is your field that you want to add spaces to. Basically this expression is saying look for any uppercase letter in the field (represented by \u). Whenever one is found, replace it with a space then that uppercase letter. Finally, I used the trim function around all of this to get rid of the space that would be added at the beginning of the string. 

 

Hope this helps!

beatrizmguerreiro
8 - Asteroid

Hey Kenda, 

 

Works perfectly. Thank you!

 

However I just realized that, in my dataset, I have this kind of situation afterall:

 

NiceTomeetYoU

 

Basically, in the middle, I have a lowercase word and a uppercase at the end of one of the words. 

 

 

Kenda
16 - Nebula
16 - Nebula

@beatrizmguerreiro 

 

It sounds like this problem might be a little too dynamic. Alteryx is great at cleaning and parsing when there are rules or patterns that it can follow. We were able to come to a solution to your first problem because we decided that before every capital letter, we would add a space. In this case, are there any rules that we can use to apply to your field to clean it up?

Labels
Top Solution Authors