*! version 1.0.0  02/02/93  STB-13: dm13.1
program define splitstr /* first rest [char] */
	version 3.0
	if "`2'"=="" | "`4'"!="" { error 198 }
	local f "`1'"
	local r "`2'"
	local c "`3'"
	if "`c'"=="" {
		local c " "
	}
	tempvar col
	quietly {
		replace `r'=trim(`r')
		gen byte `col'=index(`r',"`c'")
		replace `col'=length(`r')+1 if `col'==0
		local type : type `r'
		gen `type' `f'=trim(substr(`r',1,`col'-1))
		compress `f'
		replace `r'=trim(substr(`r',`col'+1,.))
	}
end