I'm trying to check to see if a string contains a specific unicode point from the Segoe MDL2 Assets font.
An example of a unicode value that I want to check for is
\uF14B Here's where I'm grabbing my values from
https://learn.microsoft.com/en-us/windows/uwp/design/style/segoe-ui-symbol-font
How exactly can I check a string to see if it contains one of these values?
I have tried
if (buttons[i].getText().contains("\uF14B")) { buttons[i].setFont(new Font("Segoe MDL2 Assets", Font.PLAIN, 15 )); } While this does work, I think that it's pretty ineffecient to have to copy and paste each and every value that I plan to use into a if statement.
Is there an easier way to do this?
Edit:
I ended up placing a ~ after each special character in my array, and parsed it like this. Are there any issues in doing this?
/** Creating the names of the buttons. */ String [] buttonNames = { "Lsh", "Rsh", "Or", "Xor", "Not","And", "\uE752~", "Mod", "CE", "C", "\uF149~", "\uE94A~", "A", "B", "\uF14D~", "\uF14E~", "\uE94F~", "\uE947~", "C", "D", "\uF14A~", "\uF14B~", "\uF14C~", "\uE949~", "E", "F", "\uF14A~", "\uF14B~", "\uF14C~", "\uE948~", "(", ")", "\uE94D~", "0", ".", "\uE94E~" }; /** more code here */ if (buttons[i].getText().contains("~")) { buttons[i].setFont(new Font("Segoe MDL2 Assets", Font.PLAIN, 15 )); buttons[i].setText(buttons[i].getText().substring(0, buttons[i].getText().lastIndexOf('~'))); }
Matchers for this.F1xxseries character is not a font or even a "character" really, in that it doesn't have an assigned glyph or meaning. Basically "private use" is exactly that, and anyone can use it for anything. I think some websites use the same code points for random graphical glyphs like lines, elbows and arrows to help draw their UI.