How to remove blank spaces?

Hello,

I have stored a string variable with numbers separated by blank spaces, such as: “31 2 2018”.

I would like to get the string value: “3122018”.

It is just an example. The variable could be: “1 12 2017” or “1 1 2018” for instance.
How could I do it?

Thanks a bunch.

Hi @pal1910,
you can try like this.

str = str.Replace(" ", [String].Empty) 

you have so many solutions here

http://net-informations.com/q/faq/remove.html

Regards
Balamurugan.S

3 Likes

Or trim…

Search forum and knowledge base for trim string.

Cheers,
Radomir

Hi,

You can use replace function to remove blank spaces.

TextNew=Text.Replace(" “,”")

image

4 Likes

Hello,
did it worked for u, for me I have to do something quite simislar like
G-ABG/KPT 1
so in this I need to concatenate it in such a way that it shows
GABGKPT1 altogether , I treied using replace function which is concatenating GABGKPT but not one. Could anyone help me in this… Replace("-","").Replace("/","").Replace(" “,”")
Please correct me.

If you are removing one type of character, the replace method is best. If you want to remove multiple, I’d recommend using regex replace.

I’m assuming you want to keep all alphanumeric characters and remove the rest. UiPath has a built-in ‘Replace’ activity (UiPath.Core.Activities.Replace), otherwise you can do it in an assign as well with the System.Text.RegularExpressions.Regex.Replace method. I will assume you’re using the built-in activity - fill in the following properties:

Input: This is the string variable you want to clean-up.
Pattern: “[^a-zA-Z0-9]” - this pattern will match anything that is not an upper/lowercase character or a number
RegexOption: You can leave this alone with the default settings
Replacement: String.Empty
Result: This is the output string that has been cleaned up. You can overwrite the same string variable you used as input, or use a completely different string variable, it’s completely up to you

4 Likes

ule 17.2, at the request of MOY, pending the release of an announcement regarding an operational