function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Radhe Shyam.Radhe Shyam. 

How to insert space between two characters

How to insert space between two characters?
I have:
String s = '(1 OR 2) AND 3';
I need to insert spcae between ( and 1 ;   and between 2 and ) ;so that final string should be s = '( 1 OR 2 ) AND 3'

Please help.
Best Answer chosen by Radhe Shyam.
Anand Sharma 35Anand Sharma 35
String s='(1 OR 2) AND 3';
s=s.replace('(','( ').replace(')',' )');