function insert_k_marker(numStr) local cStr if argcount() = 0 msgbox('A string must be passed as a parameter') return endif cStr = ltrim(trim(numStr)) //Remove leading and trailing spaces p = 0 if at('.',cStr) > 0 x = at('.',cStr)-1 else x = len(cStr) endif for n = x to 1 step -1 p ++ if mod(p,3) = 0 and asc(substr(cStr,n,1))<> 32 and n<>1 cStr = stuff(cStr,n,0,',') endif next return cStr