I get a string which looks like this
["{action= some text, task= some text}", "{action= some text 2, task= some text 2 }" ]
how do I extract the content of action and task and store it in two seperate string? (E.g String action and String task)
I get a string which looks like this
["{action= some text, task= some text}", "{action= some text 2, task= some text 2 }" ]
how do I extract the content of action and task and store it in two seperate string? (E.g String action and String task)
If you are the Creator of this input String
, I don't ever recommend this way of storing data. JSON is the best solution for you. No need to generate a complex REGEX
that for sure will not be generic enough to accept your future edits
JSON
is the enhanced way of storing files in a way of Parameter, Value data. You can simply create a JSON
object and use its simple way of adding data data e.g. objectJSON.put("key", "value")
. It is very similar to Object oriented, but with an external feature that is exporting your JSON
object as a string file
Here is a good example of how to use JSON and parse them.