#!/usr/bin/python3.4 # -*- coding: utf-8 -*- # Copyright © 2015 Matthieu DUVAL, Rudy DUCHE # This file is part of RizzleHash. # RizzleHash is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # RizzleHash is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with RizzleHash. If not, see from BF_Constants import * def is_int(stringInteger): try: int(stringInteger) return True except ValueError: return False def is_float(stringFloat): try: float(stringFloat) return True except ValueError: return False def getValueWithKey(value): value = str(value) argvArray = value.split(LAN_CONSTANTS.MESSAGE_SPECIAL_CHAR.SEPARATOR.value) for argv in argvArray: key = argv.split(LAN_CONSTANTS.MESSAGE_SPECIAL_CHAR.ASIGNATOR.value) key = key[0] value = argv.split(LAN_CONSTANTS.MESSAGE_SPECIAL_CHAR.ASIGNATOR.value) value = value[1] return key, value def createMessage(key,value,isNotLast): value = str(value) message = key + LAN_CONSTANTS.MESSAGE_SPECIAL_CHAR.ASIGNATOR.value + value if isNotLast: message = message + LAN_CONSTANTS.MESSAGE_SPECIAL_CHAR.SEPARATOR.value return message def createMessageList(key,content,isNotLast): message = key + LAN_CONSTANTS.MESSAGE_SPECIAL_CHAR.ASIGNATOR.value for i in range(0,len(content)): message = message + str(content[i]) if i < len(content) -1: message = message + LAN_CONSTANTS.MESSAGE_SPECIAL_CHAR.SAME_VALUE_SEPRATOR.value if isNotLast: message = message + LAN_CONSTANTS.MESSAGE_SPECIAL_CHAR.SEPARATOR.value return message