Created
March 9, 2017 13:31
-
-
Save radeinla/7efc313daaff21ee0e17126f57fe2ec0 to your computer and use it in GitHub Desktop.
Little python script for reformatting and ordering of messages.properties file
This file contains 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 format_long_line(line): | |
max_length = 120 | |
if len(line) <= max_length: | |
return line | |
i = 0 | |
formatted = "" | |
first = True | |
while i < len(line): | |
if not first: | |
formatted += "\\\n" | |
start = i | |
end = min(i+max_length, len(line)) | |
formatted += line[i:end] | |
i += max_length | |
first = False | |
return formatted |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment