Hi, I've a string like this:
header = "Header : \r\n \t \r\n \t 111 aaa 2222 3333 \r\n"
I need to clean it and leave as follows:
"Header:111 aaa 2222 3333"
The best I get is this:
header.strip.gsub(/(\s*)/,"")
=> "Header:111aaa22223333"
Obviously this is not valid since it "eats" the spaces into the header
body. How could I fix it?
Thanks in advance.
···
--
Iñaki Baz Castillo
<ibc@aliax.net>
Hi, I've a string like this:
header = "Header : \r\n \t \r\n \t 111 aaa 2222 3333 \r\n"
I need to clean it and leave as follows:
"Header:111 aaa 2222 3333"
The best I get is this:
header.strip.gsub(/(\s*)/,"")
=> "Header:111aaa22223333"
Obviously this is not valid since it "eats" the spaces into the header
body. How could I fix it?
Thanks in advance.
-- Iñaki Baz Castillo
<ibc@aliax.net>
header = "Header : \r\n \t \r\n \t 111 aaa 2222 3333
\r\n"
=> "Header : \r\n \t \r\n \t 111 aaa 2222 3333 \r\n"
header.strip.sub(/\s*:\s*/,':').gsub(/\s+/,' ')
=> "Header:111 aaa 2222 3333"
Good enough?
-Rob
Rob Biedenharn http://agileconsultingllc.com
Rob@AgileConsultingLLC.com
···
On Mar 25, 2008, at 1:51 PM, Iñaki Baz Castillo wrote: