aspose file tools*
The moose likes Beginning Java and the fly likes String replace Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "String replace" Watch "String replace" New topic
Author

String replace

Chandra S Marappa
Greenhorn

Joined: Apr 26, 2005
Posts: 19
How to replace one string with another string


Regds<br />---------------<br />Chandru
Jan Groth
Ranch Hand

Joined: Feb 03, 2004
Posts: 456
Hi chandar,

in order to help you we need more details. You might also want to study the String API, there are loads of methods, most of them quite self explaining by their name & parameter list...

Greets,
Jan
Naren Chivukula
Ranch Hand

Joined: Feb 03, 2004
Posts: 577

Hi,
Originally posted by Chandra Shekar marappa
How to replace one string with another string


String literals can't be changed once created. If you mean to ask about replacement of string variables, simple overwrite the existing string variable with new string reference

Regards,
Narendranath


Cheers,
Naren
(OCEEJBD6, SCWCD5, SCDJWS, SCJP1.4 and Oracle SQL 1Z0-051)
Hentay Duke
Ranch Hand

Joined: Oct 27, 2004
Posts: 198
First you must understand how Strings are immutable. Then you describe exactly what you want. But a simplistic answer would be.

String string1 = "String 1";
String string2 = "String 2";
string1 = string2;


But be warned you must grasp the immutable quality of Strings, because this may not be doing what you expect it to do.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: String replace