"""
-import evil_globals
-
-
# used for Computer numbers base definitions.
ALPHA_NUMERIC = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
position = len(value) #length of the string that is to be converted
for x in value:
position = position-1
- result = long(result + long(long(string.find(ALPHA_NUMERIC,x))*(long(base)**long(position))))
+ result = long(result + long(long(ALPHA_NUMERIC.find(x))*(long(base)**long(position))))
return result
def from_base(self,value,base):
#value is assumed to be a string
#convert from a defined function to base
def to_base(self,value,(to_base,from_base)):
- exec "y="+to_base[:string.find(to_base,'x')]+str(value)+to_base[string.find(to_base,'x')+1:]
+ exec "y="+to_base[:to_base.find('x')]+str(value)+to_base[to_base.find('x')+1:]
return y
def from_base(self,value,(to_base,from_base)):
- exec "y="+from_base[:string.find(from_base,'x')]+str(value)+from_base[string.find(from_base,'x')+1:]
+ exec "y="+from_base[:from_base.find('x')]+str(value)+from_base[from_base.find('x')+1:]
return y