StringFormat Problem

Hi
I have strings in the format … String is different every time
Here are few samples
DREW JAMES, INC.
ALBAWADI RESTAURANT, INC.
DRAPERY CLEANERS, INC.
I want to remove , and . from these strings
like output will be
Drew James inc
ALBAWADI RESTAURANT INC
How to make it generic so that it can work for every type of strings like that

Hi @Aima_Arif , Could you try with the below :

YouStringVar.Replace(",","").Replace(".","")

You can go with assign the same varible to same with some differance like
StringValue = DREW JAMES, INC.

Assign-
StringValue = StringValue.Replace(“,”,“”).Replace(“.”,“”)

Hi,

How about the following expression?

yourString.Replace(",","").Replace(".","")

image

Regards,

Hello,

You can try with regex method to remove special characters

System.Text.RegularExpressions.Regex.Replace(StrVariable, "[^a-zA-Z0-9\s]+", "")

This regex will replace any other character except for letters, number and space.

Regards

1 Like

Also I want to get data 5,000 sq. ft. to 20,000 sq. ft. from string
11-03 Retail - 5,000 sq. ft. to 20,000 sq. ft. (Generic Format? string changes every time)

@Aima_Arif ,

I believe for this a Split is required :

Split("11-03 Retail - 5,000 sq. ft. to 20,000 sq. ft.","-")(1).Trim

it only returns retail

Hi,

Please share few more examples.

@Aima_Arif ,

Apologies. Yes, there was a mistake. Could you check with the corrected Expression below :

Split("11-03 Retail - 5,000 sq. ft. to 20,000 sq. ft.","-").Last.Trim

Assuming that the required value is always after the Last Hyphen in the Input String.

1 Like

thank you so much

1 Like

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