Hello, I am new to searching strings so can someone please explain how to do this? I have an XML file with characters such as [%, ^, &, $, #, !] that I want to replace with a space. How would I do that? When executing the application, the user will specify an argument like this: java SearchMe Hello%Vacation! And the program should replace the %, and ! with a space and output like this: Hello Vacation Also, is the XML approach good or bad? Thanks, Vinu.
public String replace(char oldChar, char newChar) Returns a new string resulting from replacing all occurrences of oldChar in this string with newChar. If the character oldChar does not occur in the character sequence represented by this String object, then a reference to this String object is returned. Otherwise, a new String object is created that represents a character sequence identical to the character sequence represented by this String object, except that every occurrence of oldChar is replaced by an occurrence of newChar.
Note: This method is available to String objects. So... String newString = oldString.replace(oldChar, newChar); Good Luck, -Dirk Schreckmann [ February 06, 2002: Message edited by: Dirk Schreckmann ]