I have a string that contains many asterisk’ ‘*’. I want to be able to search through the entire string and swap the asterisks for another character or String.
SOLVED:
String name = getString(string[i]);
String newName;
CharSequence orig = "****";
CharSequence replaced = "Frank";
newName = name.replace(orig, replaced);
Use replace, or replaceAll. Link to relevant doc below:
http://docs.oracle.com/javase/1.4.2/docs/api/java/lang/String.html#replace%28char,%20char%29
For your problem, the answer would be
‘x’ being the character to replace ‘*’ with.