Home | Ajax | BioInformatics | Dojo | EAI | EJB | Hibernate | J2ME | Java | Java Glossary | Java Servlets | JavaScript | Jboss | JDBC | JDO | Jmeter | JSF | JSP | JUnit | Maven | MySQL | Spring Framework | SQL | Struts | Technology | WAP | Web Services | XML


 
  
 
Programming Tutorials: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML
 

 
Facing Programming Problem?
Ask Questions?, Browse Latest Questions, Question-Answer Guidelines
Java
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification
  Java Applet
Questions
Comments

String replaceAll() Method

                         

In this program you will learn how to replace all the words in a String. We are going to use replaceAll() method of String class in Java. The description of the code is given below for the usage of the method.

Description of the code:

Here, you will get to know about the replaceAll() method through the following java program. In the program code given below, we have taken a String. Then we have taken another string that contains the word to be replaced with. After that we have applied replaceAll(); method to replace that word. This method will replace all the words in a string as shown in the output.

The code of the program is given below: 

public class ReplaceDemo {
  public static void main(String[] args) {
    String str = "Her name is Tamana and Tamana is a good girl.";
    String strreplace = "Sonia";
    String result = str.replaceAll("Tamana", strreplace);
    System.out.println(result);
    }
}

Output of the program:

C:\unique>javac ReplaceDemo.java

C:\unique>java ReplaceDemo
Her name is Sonia and Sonia is a good girl.

C:\unique>

Download this example.

                         

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

1 comments so far (
post your own) View All Comments Latest 10 Comments:

I got exception,whn i run the above program

Posted by Nandana on Monday, 08.20.07 @ 10:25am | #23758

Latest Searches:
file upload servlet
how to read xml file
Jframe Tutorials
how to incress row wid
login example
sockets program using
multithreading servlet
Check Box (Form Tag) E
convert string to stin
msql
com.mysql.jdbc.drivere
Building a Simple EJB
display data from mysq
How to give color to D
java ????ร ยà¸??à
connect to sql databas
UML basics: The compon
7 basic steps for jdbc
e
code for inserting val
format a number decima
java form generator
json lib/componen...]=
json lib/componen...]=
json lib/componen...]=
json lib/componen...]=
radio tag new line
json lib/componen...]=
json lib/componen...]=
json lib/componen...]=
json lib/componen...]=
jsp to update mysql da
parseInt
set cell value ...uzac
Reading File into Byte
onmoveover tooltip mes
typesofexceptions
html programs
date operation j2me mi
fibonacci code
simple struts-config.x
inserting the data int
selectOneRadio
what is struts
timer program for MICR
collection classes
getmonths in a year
bar charts in HTML
how to retrieve image
printing datainto tabl
unstructered peer to
contains in java
compare string for une
Inserting records in t
Web Application
3DS MAX Modeling Build
PHP Flash and PHP Crea
jboss connection pool
HSSFSheet functions
Hibernate with DAO
servletandajax
Applet event button
Swing tutorials
Excel open java applic
coding of media player
performance of fedora
abstract of device, me
code to find prime num
Send email using JSP c
how to get system scre
struts file download
call ???ะà¸????????à
Contenttype
how to use the selecti
registration connect t
jxl.write.biff.RowsExc
clear the console log
source code for displa
add a list box in a fo
Delete database
Java String toLowerCase Example
Java String toCharArray Example
Java String substring Example
Java String indexOf Example
Java String startsWith Example
Java String hashCode Example
Java String matches Example
Java String length Example
Java String lastIndexOf Example
Java String isEmpty Example
Java String equalsIgnoreCase Example
Java String equals Example
Java String endsWith Example
Java String copyValueOf Example
Java String contentEquals Example
  EAI Articles
  Java Certification
Tell A Friend
Your Friend Name
Search Tutorials

 

 
 
Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.