Search code examples
javaunicode

How to strike any letter using Unicode in Java


In my Java application I want to output striked letters (like html tag do). Is there any way to do this using Unicode (combine )


Solution

  • No, this is not possible. While there is the concept of a stroke as diacritic, it's not available as a separate Unicode character, probably because the various letters that use a stroke diacritic do not place it at the same height or even angle. So the result would not resemble strikethrough markup anyway.

    To output strikethrough text in Java, you need to use an output format that allows you to use explicit markup. If you have a Swing app, you're in luck as many Swing components support HTML. Otherwise it depends on what presentation technology you're using.