diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-02-02 14:44:44 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-02-02 14:44:44 +0300 |
commit | e9cfeeda13aea1bf945bb66e4582fe6a9336fb60 (patch) | |
tree | c943c1cda2dcfa8ed0b3b94e319ba1cb46a3f4b1 /hercules/code | |
parent | 22f34f9e067822b3a5ea8137bd995b5a4508f068 (diff) | |
download | evol-tools-e9cfeeda13aea1bf945bb66e4582fe6a9336fb60.tar.gz evol-tools-e9cfeeda13aea1bf945bb66e4582fe6a9336fb60.tar.bz2 evol-tools-e9cfeeda13aea1bf945bb66e4582fe6a9336fb60.tar.xz evol-tools-e9cfeeda13aea1bf945bb66e4582fe6a9336fb60.zip |
hercules: Extent string utils functions. Now they can remove useless \r char.
Diffstat (limited to 'hercules/code')
-rw-r--r-- | hercules/code/stringutils.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/hercules/code/stringutils.py b/hercules/code/stringutils.py index 9dcbff8..0bcfaa7 100644 --- a/hercules/code/stringutils.py +++ b/hercules/code/stringutils.py @@ -30,8 +30,19 @@ def strToXml(data): def stripNewLine(data): if len(data) == 0: return data - if data[-1] == "\n": + if data[-1] == "\r": data = data[:-1] + if len(data) > 0 and data[-1] == "\n": + data = data[:-1] + return data + +def stripWindows(data): + if len(data) == 0: + return data + if data[-1] == "\r": + data = data[:-1] + if len(data) > 1 and data[-2] == "\r": + data = data[:-2] + data[-1] return data def escapeSqlStr(data): |