Skip to content

Instantly share code, notes, and snippets.

@radeinla
Created March 9, 2017 13:31
Show Gist options
  • Save radeinla/7efc313daaff21ee0e17126f57fe2ec0 to your computer and use it in GitHub Desktop.
Save radeinla/7efc313daaff21ee0e17126f57fe2ec0 to your computer and use it in GitHub Desktop.
Little python script for reformatting and ordering of messages.properties file
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