pString is the comma separated string pnumber is the sub string to select i = Integer lstrings = Integer ltemptxt = Text lstrings := STRLEN(DELCHR(pString,'=',DELCHR(pString,'=',',')))+1; CASE pNumber OF 1: EXIT(COPYSTR(pString, 1, STRPOS(pString, ',')-1)); lstrings: BEGIN i :=1; ltemptxt :=pString; WHILE j < pNumber DO BEGIN ltemptxt := COPYSTR(ltemptxt ,STRPOS(ltemptxt ,',')+1); i +=1; END; EXIT(ltemptxt); END; ELSE BEGIN i :=1; ltemptxt :=pString; WHILE i < pNumber DO BEGIN ltemptxt := COPYSTR(ltemptxt ,STRPOS(ltemptxt ,',')+1); i +=1; END; ltemptxt := COPYSTR(ltemptxt, 1, STRPOS(ltemptxt ,',')-1); EXIT(ltemptxt); END; END;Have fun.