drop function if exists fnstriptags;
delimiter |
create function fnstriptags( dirty text charset utf8)
returns text charset utf8
deterministic
begin
declare istart, iend, ilength int;
while locate( '<', dirty ) > 0 and locate( '>', dirty, locate( '<', dirty )) > 0 do
begin
set istart = locate( '<', dirty ), iend = locate( '>', dirty, locate('<', dirty ));
set ilength = ( iend - istart) 1;
if ilength > 0 then
begin
set dirty = insert( dirty, istart, ilength, '');
end;
end if;
end;
end while;
return dirty;
end;
|
delimiter ;