Created
November 20, 2013 10:18
-
-
Save AlexKordic/7560855 to your computer and use it in GitHub Desktop.
insert code in java source as string.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def to_java_multiline_string(txt, indent=1): | |
| formated = ['"' + line.replace('\\', '\\\\').replace('"', '\\"').replace('\t', '\\t') + '\\n"' for line in txt.splitlines()] | |
| separator = "\n{0}+ ".format("".join(["\t"] * indent)) | |
| return separator.join(formated) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment