Thursday, 9 June 2011

Regex to trim number to two decimal places

Not very generic, but at least easy to understand:
m/^(.+?\.[0-9]{2})/;
123.456789 becomes 123.45

1 comments:

  1. Not related to this post, but your email address on fwd.name isn't right...

    I wanted to comment on your Eee PC disassembly instructions. They were useful (thanks!) but there's a couple of things I think you could mention:

    1. If you do step 5 before step 3, you can pop the keyboard off a lot more easily and with less danger of damage.
    2. Between steps 8 and 9, I had to remove about 8 screws from the area above the palm rest/touchpad.

    ReplyDelete