Browse - Programming Tips - What's a nice way to make a heading in the Markdown language?

Date: 2015jan26
Language: Java


Q.  What's a nice way to make a heading in the Markdown language?

A.  I like this:

void putHeading(final String txt) { System.out.println(txt); System.out.println(txt.replaceAll(".","=")); }
void putSubHeading(final String txt) { System.out.println(txt); System.out.println(txt.replaceAll(".","-")); }
This works by turning every character in the heading to an equals (=). It uses the regular expression dot (.) which matches every character. The original string is not damaged. More info http://en.wikipedia.org/wiki/Markdown