First make a sketch.
Since B is between A and C, we can use segment addition postulate, AB+BC=AC ( the 2 parts create the whole)
Replace each segment with the given values.
(2x-8)+(x+17)=39 and solve for x. You should get x=10. Last step would be to substitute x for 10 in AB=2x-8. So AB= 2(10)-8=12