We don't bite newbies here... much | |
PerlMonks |
Re: numbers maskingby johngg (Canon) |
on May 16, 2012 at 07:24 UTC ( [id://970762]=note: print w/replies, xml ) | Need Help?? |
Take the separators out, preserving them and their offset adjusted for their position as it would be in the number without them. Then do the masking and, finally, put them back.
I hope this is helpful. Update: This can be simplified. The adjustment of position and replacement of separators in reverse order is not necessary. Separators can be put back into the string from left to right as, once one has been put back in, the rest of the string has been moved one character to the right so the next position is already correct without adjustment.
Breaking this down as requested by Anonymonk.
Update 2: Clarified (I hope) the wording of the first update. Cheers, JohnGG
In Section
Seekers of Perl Wisdom
|
|