title: How to add space on both sides of a character of a string in java?
body: <p>How can I add space on both sides of a character of a string in java?</p>
  
  <p>Ex- suppose string is "<code>s_id=5 and s_name!=6</code>" and if I want to add space on both the sides of <code>=</code> then output string will be like "<code>s_id = 5 and s_name!=6</code>"</p>
  
  <p>I am trying this using replace and contains method...</p>
  
  <p>I check <code>if(str.contains("="))</code> then replace it with(<code>" = "</code>) but it also adds space for <code>!=</code>.</p>