Reputation: 711
Let's say I have a string :
{"id":"123","xCoord":"01.234567","yCoord":"89.012345","etc.":"etcetc"}
I want to extract only the xCoord part - the number 01.234567 and put it into a string array String[] xCoords = {};
I cannot use the public String substring (int start, int end)
function because in future the id will eventually grow up and I don't have a firm index to use.
What would you suggest me - is there any way of extracting only the symbols after "xCoord":"
and before ","y...
Upvotes: 0
Views: 183
Reputation: 62392
The best (and most reliable) option would be to convert your string (which is valid JSON) into an object and reference it that way.
Convert JSON String to Java Object or HashMap
Upvotes: 2