function GetBefore(substr, str:string):string; {©Drkb v.3(2007): www.drkb.ru, ®Vit (Vitaly Nevzorov) - [email protected]} begin if pos(substr,str)>0 then result:=copy(str,1,pos(substr,str)-1) else result:=''; end; function GetAfter(substr, str:string):string; {©Drkb v.3(2007): www.drkb.ru, ®Vit (Vitaly Nevzorov) - [email protected]} begin if pos(substr,str)>0 then result:=copy(str,pos(substr,str)+length(substr),length(str)) else result:=''; end; 演示: 1) GetBefore('-', 'Total-2.00$') // 结果 "Total" 2) GetAfter('-', 'Total-2.00$') // 结果 "2.00$" 3) GetBefore('$',GetAfter(' - ' , ' of Total-$ 2.00 (the total) ' ) // 结果"2.00"