I have a field that has the following value
RISARALDA Estación Pereira amaneció inundada
It is with many unnecessary spaces, when I do a select TRIM () it does not take away all the spaces of the medium, only those of extremes.
If I paste the value here in stack it does not show me the spaces but it would be something like this:
Los espacios representados con los puntos
RISARALDA ................ Pereira station woke up flooded
Query:
SELECT *,TRIM(titulo) as trimtitulo FROM noticias WHERE id=2797254;
SOLVED
I think I understand that the trim does not take the "tabs" in the strings (I think I'm not sure, but this function solves it)
DELIMITER //
CREATE FUNCTION trimMejorado(str LONGTEXT) RETURNS LONGTEXT
BEGIN
while instr(str, ' ') > 0 do
set str = replace(str, ' ',' ');
end while;
while instr(str, ' ') > 0 do
set str = replace(str, ' ',' ');
end while;
return trim(str);
end //