×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Text
Posted by: Harshit Vasoya
Added: Jan 21, 2021 5:08 AM
Modified: Jan 21, 2021 5:08 AM
Views: 4678
Tags: no tags
  1. public class StringReplaceEmp {
  2. public static void main(String args[]) {
  3. String str="Hello World";
  4. println( str. replace( 'H','W' ) );
  5. println( str. replaceFirst("He", "Wa") );
  6. println( str. replaceAll("He", "Ha") );
  7. }
  8. }