Separated out string functions from markdownlatex.c