Let's say I have a string, different version of the input string:
a) Name='book' Number='345' Version='12' Author='name1'
b) Name='book' Version='12' Author='name1' Number='345'
I need to remove Version='xx' and Number='xx'from this input string. Values of this parameters can be always changed.
What is the best way to do it? I tried regex, something like:
String input = input.substring(0, input.indexOf("Number")) + "" + input.substring(input.indexOf("Version"));
But that would work only for this case:
a) Name='book' Number='345' Version='12' Author='name1'
But not for this:
b) Name='book' Version='12' Author='name1' Number='345'
So how to make a general approach?