Place Holder Products Code
Bash MySQL
Notes Return of the Fed Login
Admin Control Panel Email Control Panel Product Control Panel Debug Info Beacon Create Snippet Tag Control Panel

Code

*More fully fledged applications can be found on the Products page. The Bash page is dedicated to fully commented oneliners, and a MySQL quick reference is available here.



				
# Will Bergen # 2014 # charConverter - add \'s before any 'space' in the input string # This will take any sting and replace spaces, 'space', with \'space'. # Only useful for stings with spaces. # Designed for OS interaction applications where you need to escape the 'space'. # For instance, if the string is a path, it will not act the way you expect until it # has been properly modified with \'s the usual escape character. # / --> ASCII # 92b class charConverter: def fillArray(self, s): tempArray = [] for c in s: #print c tempArray.append(c) return tempArray def fixSpecChars(self, a): fixedArray = [] ct = 0 for c in a: if (c == ' '): fixedArray.append(chr(92)) fixedArray.append(c) else: fixedArray.append(c) ct = ct + 1 return fixedArray def convert(self, a): finalStr = ''.join(a) return finalStr def masterConvert(self, s): a = self.fillArray(s) a2 = self.fixSpecChars(a) return self.convert(a2) #Test Area: x = charConverter() print x.masterConvert("Test string with a lot of spaces....")