From 746192af34a65504cb86a4eca068a8f0fbb361f5 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 31 Oct 2014 01:08:46 +0300 Subject: hercules: split implimentation to many files. --- hercules/code/stringutils.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 hercules/code/stringutils.py (limited to 'hercules/code/stringutils.py') diff --git a/hercules/code/stringutils.py b/hercules/code/stringutils.py new file mode 100644 index 0000000..09e3cf8 --- /dev/null +++ b/hercules/code/stringutils.py @@ -0,0 +1,28 @@ +# -*- coding: utf8 -*- +# +# Copyright (C) 2014 Evol Online +# Author: Andrei Karas (4144) + +def stripQuotes(data): + if len(data) == 0: + return data + if data[-1] == "\"": + data = data[:-1] + if data[0] == "\"": + data = data[1:] + if data[-1] == "'": + data = data[:-1] + if data[0] == "'": + data = data[1:] + return data + +def stripQuotes2(data): + for idx in xrange(0, len(data)): + data[idx] = stripQuotes(data[idx]) + return data + +def strToXml(data): + data = data.replace("&", "&"); + data = data.replace("<", "<"); + data = data.replace(">", ">"); + return data -- cgit v1.2.3-70-g09d2