REPLACE CHARACTERS OF A STRING

 ************************************************************************ 

W.A.P TO REPLACE CHARACTERS OF A STRING

************************************************************************  

JAVA Program







   



  
Online compiler

Output:


************************************************************************ 

C Program



Online Compiler 

 

************************************************************************ 

C++ Program

Online Compiler

************************************************************************ 

C# Program


 
 
Output:

************************************************************************ 

PHP Program


Online Compiler

Php is a server side scripting language.

************************************************************************ 

JAVASCRIPT Program

 <script type="text/javascript">

// var string = prompt("Enter a string: ");
var string = "Mr. Red has a red cap and a red book";
var reg =new RegExp('red','gi');
var newString = string.replace(reg,'blue');
console.log(newString);





</script>

Online Compiler

************************************************************************ 

PYTHON Program

 

Online Compiler: 

************************************************************************  









Comments

Popular posts from this blog

SAME NAME IN CLASS METHOD AND CONSTRUCTOR

PALINDROME NUMBER

FIBONACCI SERIES