Need to check the values in a datatable

8 MURALI/BEJOYMR 3473844066 COK-BOM-RUH- BOM-COK COK-BOM-RUH- BOM-COK KERALA COK COK 26,575.00 140.00 3,846.00 26,715.00 0.00 26,715.00 0.00 0.00 0.00 0.00 5.00 1,336.00

In the above data, i need to trim the spaces comming on the left and right side of hyphen (-).

Here in this case there is RUH- BOM, here after " - " there is a space, I need to trim it.

How can i achieve that…?

Refer the below regular expression

image

Hi @jishnupnair1996

We can remove the spaces by replacing the space. You can use the below command.

 String Var = "8 MURALI/BEJOYMR 3473844066 COK-BOM-RUH- BOM-COK COK-BOM-RUH- BOM-COK KERALA COK COK 26,575.00 140.00 3,846.00 26,715.00 0.00 26,715.00 0.00 0.00 0.00 0.00 5.00 1,336.00"

Var = Var.Replace(" ","")

This command will remove all the spaces in your string.

If this works for you, please mark it as the answer too :slight_smile:

Let know how it goes…

@Lahiru.Fernando

Hi Bro,

I only need to remove the spaces after/before the hyphen (-)

Can you check on this issue.

Hi bro… try this

nickname.Replace("- ","-").Replace(" -","-")
2 Likes

Hi @jishnupnair1996,

Have you tried the solution mentioned in the above post.

thanks for your reply…

this is not working

What is the error you are getting?

What is the expression you have used

Thanks Bro,

this works…

system.text.regularexpression.regex.replace(var,"(?<=-)","")

This is the code that i used…

itdoesnt throw any error but the input is still like that

After = Symbol it is hyphen and there is a space after )

System.text.regularexpression.regex.replace(var,"(?<=-) “,”")

Still the issue remains

Not sure where you are going wrong.

Refer the below workflow

Main.xaml (4.1 KB)

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