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