I have a long String, which is a json files contents. Somewhere in this String, it contains the following: "totalWinAmount":100
To find and return this value, I'm currently doing this:
int totalWinAmountIndex = line.lastIndexOf("totalWinAmount");
String resultTotalWinAmount = line.substring(totalWinAmountIndex + 16, totalWinAmountIndex + 19);
This works, resultTotalWinAmount is correctly set to 100, but I'm curious if this is the best practise for a situation like this, whether this is actually awful coding, or if there's a better way of doing it?