java - Delete characters between other -


I have too many sentences and "ga-te", "ga-te" etc. in this string. I do not need to change all words like "Gate" from "Ga-Te" and touch each other. I tried to use regexp but it failed. Can you help me with this? Sorry for my bad english

You can place in the place you want to keep and see those groups in the replacement call .

  string s = "ga-te, ga - te, foo-bar"; S = s.replaceAll ("([a-z]) * - * ([a-z])", "$ 1 $ 2"); Println (s); // = & gt; "Gate, Gate, Fobar"  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

asp.net mvc - How to attach sql database to a javascript graph -

c# - How to know the number of Threads created and limit the Tasks accordingly -