module TerraHS.Misc.StrFunctions	 where
	 
import Data.Char

get_head::[Char]->Char->String
get_head ([]) sep = []
get_head (x:xs) sep 
	|x == sep = []
	|otherwise = x : (get_head xs sep)

get_tail::[Char]->Char->String
get_tail ([]) sep = []
get_tail (x:xs) sep 
	|x == sep = xs
	|otherwise = (get_tail xs sep)

string2int :: String -> Int -> Int

string2int [] _ 	= 0
string2int [x] 10	= digitToInt x

string2int (x:xs) y 	| x == '-' = (-1) * string2int xs y
			| not (isDigit x) && (toUpper x < 'A' || toUpper x > 'F') = undefined
			| otherwise = (digitToInt x)  * (y ^ length xs) + string2int xs y

string2decimal :: String -> Int 
string2decimal str = string2int str 10