How to make a replace in this string

Hello people,

I need help to get this big space out of this string

I’ve tried using MyString.replace (" ", “”), but it doesn’t work, I’ve tried MyString.replace (envirioment.newline, “”), but nothing worked.
Replace

Hi,

Can you try the following expression?

System.Text.RegularExpressions.Regex.Replace(text,"\s+","")

Regards,

2 Likes

@Romario_Almeida Since you have used WriteLine Activity to Log the value, you can double Click on that printed line in the Output Panel, which will allow you to look at the hidden characters present in that data, then you can do a Regex Replace according to those characters present. It might be a new line as well.

1 Like

@Yoichi

Thanks for the help, it worked, but he ended up removing the spaces in the middle of the text, would there be anything to fix it?

DIREITOPENAL-TUTELAPENALDASRELAÇÕESECONÔMICAS.pdf

would have to stay like this

DIREITO PENAL-TUTELA PENAL DAS RELAÇÕES E CONÔMICAS.pdf

Hi,

How about the following expression?

System.Text.RegularExpressions.Regex.Replace(text,"\s{2,}","")

Regards,

3 Likes

@Yoichi

It worked, thank you very much for your help

1 Like

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