I have a string with this format:
"key=some value|otherkey=other value|key3=yet another value"
I need to create a function with this signature:
public String update(String all,String key, String value)
Where all
is the previous string, key
the given key to replace (or add) and value
the new value.
I thought about some solutions but they are hard to read and not very elegant. I was hoping one of you guys could come with something that looks better.
PS: I have no problem in using regexes but it needs to be done without any 3rd party lib, just the standar java lib.
Thanks!