def _escapeText()

in pachi_py/pachi/tools/sgflib/sgflib.py [0:0]


def _escapeText(text):
	""" Adds backslash-escapes to property value characters that need them."""
	output = ""
	index = 0
	match = reCharsToEscape.search(text, index)
	while match:
		output = output + text[index:match.start()] + '\\' + text[match.start()]
		index = match.end()
		match = reCharsToEscape.search(text, index)
	output = output + text[index:]
	return output