Im trying to fogure out a way to allow a user to define the quantities of an exercise without the tedius multiple text fields they have to tap and fill out. Id like to allow them to write however they want and i just parse it. There aren't many ways to define the quantity of an exercise "3 sets of 10 at 40 lbs", "set 1) 10 reps @ 100 kg, 30 seconds rest ...." , "3 sets of 8,9,10 reps at 100, 200, 300 lbs", "3 sets of go until failure with 1 minute rest in between", "3 sets of 10 reps, 30 seconds, then go until failure with 100, 50, and 45 kg, 30 seconds rest in between". I was wondering if anyone knew a good way to parse a users string when we can make assumptions about the format of the users input? my out json model would be a list of "set" items as defined:
set = { "setId":UUID, "setOrder": integer, "unit" : String, /* only either lbs or kg*/ "weight" : Float, "reps" : Integer, # only one of these can be > 0 (or True in the case of untilFalure) "time" : Integer, # if one is set then the others must be 0 or false "untilFailure" : Bool, # "rest" : Integer }