Think of your brain as a dog. Or your body or your tooth or basically whatever part of you that you think is responsible for sugar cravings. Just like a dog begging at the table that part of you craves chocolates and candy and cake and SUGAR! Do you think your dog is going to stop begging at the table if you only give in once in a while? No, what you are doing then is called random reinforcement or intermittent reinforcement and it is more efficient than regular positive reinforcement (yes, even if you are unintentionally training an undesirable behaviour it is called positive whenever it includes reward).
So basically, if you want to get rid of your sugar cravings you have to starve them out. The process is called extinction. Whenever your brain misbehaves, and tries to make you eat something you've chosen not to eat, you have to ignore it and/ or go do something else. Like eating some good food. Cravings are stronger when you are hungry. Melissa Hartwig recommends not going to fruit to satisfy the craving but eating something less sweet, but preferably going without snacks and rather eat at mealtime. Makes sense to me.