hello guys i have a 2 scenerios
1)
“PRINCETON, NJ 08540-6819”
this is string
i want this string look like “PRINCETON,NJ,08540-6819”
2)i have a another string
“SPIRIT LAKE, IA 51360”
i wanna have look like this “SPIRIT LAKE,IA,51360”
but the problem is when i use replace function
the ans i get is “SPIRIT,LAKE,IA,51360”(which is wrong)
pls help me
Hi @arjun27
You could use a regex to add the comma where it should be:
System.Text.RegularExpressions.Regex.Replace("SPIRIT LAKE, IA 51360","([A-Z]{2}) (\d+)","$1,$2")
This will change:
SPIRIT LAKE, IA 51360
into
SPIRIT LAKE, IA,51360
here i dont need to give space between spirit lake,IA
Hi @arjun27
Try…
- “PRINCETON, NJ 08540-6819”
ABC.Replace(" “,String.Empty) or ABC.Replace(” “,”")
Looks Like:
“PRINCETON,NJ,08540-6819”
Regards
Farhan
Okay, let’s smartly remove all the spaces around the commas first:
System.Text.RegularExpressions.Regex.Replace("SPIRIT LAKE, IA 51360","\s*,\s*",",")
This will change
SPIRIT LAKE, IA 51360
into
SPIRIT LAKE,IA 51360
Now let’s add a comma where it should be:
System.Text.RegularExpressions.Regex.Replace("SPIRIT LAKE, IA 51360","([A-Z]{2}) (\d+)","$1,$2")
This will change:
SPIRIT LAKE,IA 51360
into
SPIRIT LAKE,IA,51360
Fresh Excel.xlsx (23.3 KB)
Delivery_to(CityLocation).xaml (421.7 KB)
i have gave u my flow and excel sheet
u can filter according to length
u can find the ans in City_location column
Fresh Excel.xlsx (23.3 KB)
Delivery_to(CityLocation).xaml (421.7 KB)
i have gave u my flow and excel sheet
u can filter according to length
u can find the ans in City_location column
thanks
sanjay
ur workflow has solved my problem
Regards
Arjun