Replace Dash sign with hyphen

How to replace Dash sign with hyphen sign ?


Due to that my if condition goes to else part
@Sudharsan_Ka @supermanPunch @Anil_G

1 Like

Look at bottom - 2 dates at output panel

Hi @pravin_bindage ,

Check this below code,
"YourInputString".Replace("—","-")

Still same problem
it was not replaced

Hi @pravin_bindage ,

Try with this,
"YourInputString".Replace("-","—") And can you share your input strings here if its not replaced?

still same
Input String - 12:00 PM – 1:00 PM
Op String - 12:00 PM - 1:00 PM

@pravin_bindage

Please try this

str = str.Replace(ChrW(&H2010), "-").Replace(ChrW(&H2013), "-").Replace(ChrW(&H2014), "-")

cheers

Hi @pravin_bindage ,

Check this below code now,
"12:00 PM – 1:00 PM".Replace("–","-")

HI @pravin_bindage

Checkout this

System.Text.RegularExpressions.Regex.Replace("12:00 PM – 1:00 PM","–","-")

Regards
Sudharsan

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