First of all, let us get down from Heaven and enter the real world. It is no possible way to avoid sugar totally, 100% until the end of all times. That is just pure Utopia. So, let us think more human-like. 

 We have to clarify one very important thing, and that is: sugar craves more sugar. That means, the more you consume of it, the more addicted to it you become. Sugar and sweet addiction are just like any other addiction in this world. More and more craves more and more. 
The logical method to avoid it is simply not to consume it at all. Not in the morning, not in the afternoon, and definitely not in the evening... (Worse than that doesn't really exist...)  This statement seems, however, contradictory with my previous one, namely, that any way you try, 100% you can never eliminate it from your diet. But, don't worry, I'll explain. 
 Sugar is actually a simple carbohydrate. Like its name already suggests, it can be easily used by our organism, easily digested, so we benefit from the energy right away. In comparison with complex carbohydrates, which are more slowly digested and we can not obtain energy so easily from them. This may suggest, that the quicker we receive the benefit, the better they are, ergo simple carbohydrates rule! Or do they? The problem is, that the quantity of energy simple carbohydrates offer are way more than what we need for our daily activities, which often are pretty much sedentary. In order to sit at a computer 9 hours, you won't need 500 kilocalories every 2-3 hours, which chocolate bars and other sweets offer, which we can so easily grab even more than once, during the day. The exception is if you are living in the jungle, and every 2-3 hours a hungry tiger goes chasing you...then you'll need those sugars of course...otherwise just forget it. And if you eat one, you will probably want another one too. Be sure of that. So the best way to avoid wanting them at first place is, not to eat them at the first place. 

 Before you stop eating sugar and sweets containing it, you have to be conscious about some things, otherwise, you will not be able to control the urge. So, the way to stop eating them is to be prepared for what is going to happen in the moment you refuse these pleasures to yourself: change in your mood. Oh yes. You will get a little bit nervous, moody, tired...you name it. You will feel without energy...can't continue... When I did this I even had the feeling, that not the coffee was keeping me awake, but the sugar in it. I was drinking a small espresso with 2 sugar and Nescafe with 3-4 cubes. And I really did renounce to it. The irony, that from one Monday.
 I drink my coffee, tea whatever without sugar now. But the first 2-3 days were horrible. I had problems even going to the gym. I almost fall asleep among sets and didn't want to do squats because they seemed just too hard. My trainer laughed and told me, that I should not worry. If I survive the cravings, mood changes 1-3 days, they will pass. And so they did. They truly did,  even I started to feel more energy afterwards. But the first 3 days, especially the first was truly horrible. The sweet craving was bad, I felt stressed and sleepy. But you have to be strong and hold on. Occupy yourself with something. Make yourself Turkish coffee, green tea, even more times a day. Eat a meal every 3 hours. If you really need to snack on something, choose some raw nuts. Avoid salty things, because very salty tastes also may cause sugar cravings. Think all the time, that you have to keep up only 2-3 days. Afterwards, cravings really and actually stop. You will be surprised, how you won't give a damn about the chocolate on the shelves in the supermarket. 
Also do not be afraid of getting back to your addiction. Time will come, when you will be in a circumstance where you might want or have to eat sweets, cookies, etc. Company party, reunions... If you refuse everything, people might even get upset...”Look, I made this cookie...taste it”... You can not refuse and say, I don't give a damn about your cookie...You have to realize that you are strong. When you get strong, one exception won't make the rule. It will even feel strange. Too sweet. And one will be enough. So you won't hurt anybody's  feelings, still you did no harm to yourself. Thank God reunions, and company parties don't come every other weekend....
Taste buds must and can be educated. I am speaking of experience, not boring statistics, but self-education and trying things on myself. Our whole perception of taste can be “rebooted”. Believe me! It can! And the reboot means the new you! The sexier, healthier and more confident YOU. We are trying only to educate our mind. That is just so wrong. Everything starts in the mind, that is true, but the body has to be taught to, otherwise it will be a disorder among the two. And disorder, chaos, especially when it is inside us, never leads to any good thing. The chaotic way of life usually drags upon, chaotic way of eating and all kinds of cravings. We can not avoid chaos, stress all the time, but surely we can minimize. Our life is in our own hands. And if you feel it is not, that change something, so it will be. You have to be in control, not a chocolate bar. It even sounds stupid, but sometimes seems to be the truth. Be in charge and feel in charge!