Prev: FAQ 4.10 Why aren't my random numbers random?
Next: regex inserting a - for every third digit in a number from rightto left
From: lennie on 16 Jul 2010 14:53 Hi group! Apologies if this is trvial for you, but I try to construct a s/ / /g that will insert a - for every third digit in a number from right to left, ie: 123456 -> 123-456 1234567 -> 1-234-567 123 -> 123 (no - as first char) etc.. It might be possible to do this with a cpan library function, but I would like to have this done in a simple sentence. Regards Erling
From: lennie on 17 Jul 2010 12:51
Thanks all. This was helpful. Regards Erling "lennie" <erling.kopperdal(a)lyse.net> skrev i melding news:ltqdnRPPT_lVN93RnZ2dnUVZ7tednZ2d(a)lyse.net... > Hi group! > > Apologies if this is trvial for you, but I try to construct a s/ / /g that > will insert a - for every third digit in a number from right to left, ie: > 123456 -> 123-456 > 1234567 -> 1-234-567 > 123 -> 123 (no - as first char) > etc.. > > It might be possible to do this with a cpan library function, but I would > like to have this done in a simple sentence. > > Regards > Erling > |