Reputation: 850
For my command-line-interfaces it's often nice to have a little ASCII art in the beginning, but those often contain many backslashes.
For example:
System.out.println(" _____ _______ _____ _ __ ");
System.out.println(" / ____|__ __|/\ / ____| |/ / ");
System.out.println("| (___ | | / \ | | | ' / ");
System.out.println(" \___ \ | | / /\ \| | | < ");
System.out.println(" ____) | | |/ ____ \ |____| . \ ");
System.out.println("|_____/ |_/_/ \_\_____|_|\_\ ");
But since every \
needs to be a \\
this often looks very ugly in code and it's very hard to find/fix an error in the 'font'. Is there a way to tell Java NOT to use escape sequences?
Upvotes: 8
Views: 11405
Reputation: 29
Hate to gravedig this thread, but for anyone else out there looking for this.. Try using unicode!
For example: \u0092 = "\"
Upvotes: 2
Reputation: 523
read that "image" from file, that file can be in your jar library :)
Upvotes: 2
Reputation: 1503090
No, Java doesn't have anything like the "verbatim string literals" of C#. If you want to do ASCII art, consider putting it into a text file instead and loading that from the code.
Upvotes: 3