Flavonoids can help reduce the growth of H. pylori, which causes some ulcers. Foods that are high in B-vitamins and calcium, such as almonds, beans, spinach, kale, and other dark leafy greens, can also be helpful when you have an ulcer. slide 2 of 7.