Introducing Radical.sh

Forget Code launches a powerful code generator for building API's

String Replace - using replace function in Java

  1. public class StringReplace{
  2. public static void main(String args[]){
  3. String str="Replace Region";
  4. System.out.println( str.replace( 'R','A' ) );
  5. System.out.println( str.replaceFirst("Re", "Ra") );
  6. System.out.println( str.replaceAll("Re", "Ra") );
  7. }
  8. }