Показать сообщение отдельно
  #9  
Старый 23.05.2012, 07:16
Pyro Pyro вне форума
Так проходящий
 
Регистрация: 18.07.2011
Сообщения: 805
Версия Delphi: 7Lite
Репутация: 6063
По умолчанию

вобще непонятно откуда эти запятые и зачем их убирать,
но если stringrepace-ом, то можно так:
PHP код:
type
  my1 
= record from,to_:string end;
  
my2 = array[0..7] of my1;
const 
replaces: my2 = (
                         (
from:', '; to_:','),
                         (
from:' ,'; to_:','),
                         (
from:' .'; to_:'.'),
                         (
from:'. '; to_:'.'),
                         (
from:',,'; to_:','),
                         (
from:',.'; to_:','),
                         (
from:'.,'; to_:'.'),
                         (
from:'..'; to_:'.')
                       );
function 
cleanonce(s: string): string;
var 
i: integer;
begin
  
for i := 0 to high(replaces) do
    
s := StringReplace(s, replaces[i].from, replaces[i].to_, [rfReplaceAll]);
  
result := s;
end;
function 
clean(s: string): string;
begin
  
while s <> cleanonce(s) do s := cleanonce(s);
  
result := s;
end; 
Ответить с цитированием