I'm writing a program where there is a particular string in a line to be replaced
Below is my sample program.
public class MyFirstJavaProgram {
public static void main(String []args) {
String x="<link rel=\"stylesheet\" type=\"text/css\" href=\"abc.css\" />";
System.out.println(x);
}
}
In the above program I want to replace abc.css
with xyz.css
. I'm aware of general String replacement function like String.replace(oldString, newString)
, But here the problem is that abc.css
changes from file to file. I want to replace anything.css
with xyz.css
.
Here is a working Example Fiddle
please let me know how can I do this.
Thanks