|
Validates_format_of :price_in_cents, :with =>
What is the regexp for this simple validation
Started by Sam on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
/[0-9]+/ Matches one or more integers, however there are better ways to do this (as seen in marklai's answer). .
You can use validates_numericality_of with only_integer, combined with positive numbers to represent price in pennies .
|
|
I am storing a cost in my application. The cost is not formatted in the database. For example: 00.00 saves as 0, 1.00 saves as 1, and 40.50 saves as 40.5
I need to read these values from the database and convert them to strings for dollars and cents. ...
Started by Tony on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
So 1 dollar is stored as 100 accomplish that with this little bit of Ruby code:
fmt = "%05.2f" % cost cost_dollars, cost_cents = fmt.split '.'
sprintf is your friend....
Instead of storing as a decimal, store as an integral number of cents.
|
|
Historical Lg Cents and Half Cents Reference Here is a link to a great book from 1878 on large cents and half cents.
http://www.archive.org/stream/cu3192...e/n19/mode/2up
"A penny hit by lightning is worth six cents" Opie Taylor
"When someone asks you...
Started by PennyGuy on
, 6 posts
by 5 people.
Answer Snippets (Read the full thread at numissociety):
This is the only 1793 Strawberry....
NGC Census: 1; none finer.
Got into a wrestling match at an auction, whether over the Strawberry Leaf Cent itself or over "Frog Run" Auction (Nov 30 2004) for this Strawberry Leaf Cent (price realized $414,000).
|
Ask your Facebook Friends
|
In 1915 a Gallon of Milk cost 36 cents and a Gallon of Gas 25 cents, today Milk is $3.88 and Gas is $3.81
I blame Obama!
Started by busybody on
, 6 posts
by 4 people.
Answer Snippets (Read the full thread at literotica):
Oddly enough, adjusting for inflation, that means milk and gas, as you call it, have fallen in price... .
A surplus of gas lead to accusations against germany.
You may blame someone else women had larger breasts in 1915 and therefore milk was in abundance .
|
|
10 cents to one son, and 15 cents to another, the time is 1:45. The man gave away a total of 25 cents. He divided it between two people. Therefore, he gave a quarter to two.
Started by Answered on
, 1 posts
by 1 people.
Answer Snippets (Read the full thread at chacha):
|
|
I have a label (literal, whatever), that is being filled with currency ($5000.00). Is there an easy way to style the cents, like make the font-size smaller.
I know I can split the two up, but I am using MVP, and am looking for an easy way than passing...
Started by Martin on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
$5000.<span class="Cents">00</span>
How you accomplish this is a bit tricky, you can have a "Dollars" and a "Cents" property.
Ideally you need to format it like the following.
|
|
Hi,
I'm trying to figure out how to round a monetary amount upwards to the nearest 5 cents. The following shows my expected results
1.03 => 1.05 1.051 => 1.10 1.05 => 1.05 1.900001 => 1.10
I need the result to be have a precision of 2 (as ...
Started by Don on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
Tom has the right idea, but you need to use BigDecimal methods, since you ostensibly are using BigDecimal because your ... .
It's a hack, but should get you the right answer .
I'd try multiplying by 20, rounding to the nearest integer, then dividing by 20 .
|
|
I an an American, and regualry get boxes of cents to look through, and I always get a Canadian penny or two. My question to you Canadian cent hunters is do you ever find US cents in your rolls like I find Canadian cents in mine?
Thanks
Started by The Silver Searcher on
, 15 posts
by 14 people.
Answer Snippets (Read the full thread at coincommunity):
With the other the time, cent,nickels....
I even get a lot of wheats.
cents in a roll.
Usually, I get 3-6 U.S.
Likewise, Canadian cents were commonAll the time.
Of wheats, I recall getting a steel cent at a Canadian McDonalds.
|
|
The real number of net profit per share is 19 cents pershare compared to 13 cents the previous quarter. An increased of almost 50% on declining revenues.
19cents : 98.6M$(net profit excluding non-cash bs) / 512M$ common share= 19 cents
Started by lion_salomon on
, 13 posts
by 1 people.
Answer Snippets (Read the full thread at stockhouse):
Absoulutely....
Good luck to all,
W.K.
Or
13 cents X 4 X 10 = 5.2 dollars.
It should be 19 cents X 4 = 76 cents.
Dollars by end of year....yellow directory page counts are up 30 per cent yah your right 20 cents shares.
|
|
Gilbert's "Rubber Balls and Liquor" now 94 Cents on Amazon (Hardcover) Hey, for 94 cents, I'll buy anything.
http://www.amazon.com/gp/product/031...tag=slickdeals
Started by Horff on
, 15 posts
by 12 people.
Answer Snippets (Read the full thread at dawgsaloon):
Caller: What is this, AGT 100 and AGT 101??? I bought it, I enjoyed it
I also make a lot of stupid videos using Gilbert's... .
I'll pass even at that basement-bargain price.
I wasted my money on that Kindle piece of shit .
And yet the Kindle version is $15.
|