Perl Regular Expression: Eliminare spazi all'inizio e alla fine di una stringa

Elimina uno o più spazi all'inizio ed alla fine di una stringa.

$stringa =~ s/^\s+|\s+$//g;

Es: $stringa " Ciao a tutti " restituisce "Ciao a tutti"

 

Comments

I will immediately grab your rss as I can not in finding your email subscription hyperlink or newsletter service.
Do you have any? Please permit me realize in order that I could subscribe.

Thanks.

This blog was... how do you say it? Relevant!! Finally I have
found something which helped me. Thanks!

Add new comment