Commit 1fd72612 authored by Sriram Karra's avatar Sriram Karra

New routine for some convenience string manipulation

parent b90406f7
##
## Created : Tue Jul 26 06:54:41 IST 2011
## Last Modified : Mon Apr 02 14:54:10 IST 2012
## Last Modified : Sat Apr 07 23:44:09 IST 2012
##
## Copyright (C) 2011, 2012 by Sriram Karra <karra.etc@gmail.com>
##
......@@ -9,6 +9,16 @@
import re
def chompq (s):
"""Remove any leading and trailing quotes from the passed string."""
if len(s) <= 2:
return s
if s[0] == '"' and s[len(s)-1] == '"':
return s[1:len(s)-1]
else:
return s
## The follow is a super cool implementation of enum equivalent in
## Python. Taken with a lot of gratitude from this post on Stackoverflow:
## http://stackoverflow.com/a/1695250/987738
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment