I have a few buttons that should make it simple to add accents to letters so that for instance é can be typed by pressing the ´ button and then entering an e.
Is there any easy way to add a certain accent to any letter, so that I don’t have to create dozens of if statements for every letter that can have this accent? Is there maybe a link between the Unicode number of the letter and the letter with an accent?
Any suggestions would be appreciated, Fabian
I don’t think there is a simple combination of unicode math that you can apply here, but you can make your procedure much more efficient by making a lookup dictionary.
make the key be the letter + a symbol for the accent, then store it in a dictionary in your class
Then later, using the letter pressed by the user, and using your accent button to generate the second half, construct the key and look it up in the dictionary. This way, you avoid all of the if statements. Remember to construct your dictionary in
initor elsewhere.