Comments (4)
Oops - the regex is incorrect. brb.
Original comment by [email protected]
on 24 Oct 2012 at 6:17
from origami-pdf.
The regex should be this:
sprintf("%f", self).sub(/(?:\.0*$)|(\.\d*[^0]+)0*$/, '\1')
Seems to work better:
irb(main):014:0> [0, 0.000001, 344, 344.5, 344.55, 344.05, 344.0506].each { |a|
puts sprintf("%f", a).sub(/(?:\.0*$)|(\.\d*[^0]+)0*$/, '\1') }
0
0.000001
344
344.5
344.55
344.05
344.0506
Original comment by [email protected]
on 24 Oct 2012 at 6:29
from origami-pdf.
OK - home now and off my bike. I simplified the regex a bit:
sprintf("%f", self).sub(/\.0*$|(\.\d*[^0])0*$/, '\1')
irb(main):004:0> [10110, 1011, 10.11, 1.011, 0.1011, 0.01011, 0.001011].each {
|a| puts sprintf("%f", a).sub(/\.0*$|(\.\d*[^0])0*$/, '\1') }
10110
1011
10.11
1.011
0.1011
0.01011
0.001011
Original comment by [email protected]
on 24 Oct 2012 at 8:12
from origami-pdf.
Thank you, I committed your last version :)
Original comment by [email protected]
on 20 Dec 2012 at 4:18
- Changed state: Fixed
from origami-pdf.
Related Issues (20)
- Issues with using Origami in REMnux HOT 1
- Error on saving obfuscated pdf
- ccittfaxdecode issue when rows > 1 HOT 1
- Support filter abbreviation HOT 1
- Patch for /lib/origami/graphics/instruction.rb HOT 1
- Patch for /lib/origami/graphics/instruction.rb HOT 1
- Linearized document causes error: Cannot remove last revision
- Can't decrypt file because of wrong padding HOT 1
- Cannot compute correct okey in AESv3 R5 HOT 1
- pdf.encrypt incompatible character encodings: UTF-8 and ASCII-8BIT HOT 2
- No tests, examples, or documentation on how to use acro/xdp forms
- Error: uninitialized constant Origami::DICT_SPECIAL_TYPES HOT 1
- Created ruby script from PDF, script produces error HOT 4
- Please include tests in releases uploaded to rubygems
- Move project to GitHub
- The avast detected origami includes virus
- Unable to process signed document from Adobe Echosign
- Creating clean pdf destroys pdf
- Error during launch of pdfwalker
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from origami-pdf.