decimal point #2

------=_NextPart_000_001D_01C1A834.21827C90
Content-Type: text/plain;
	charset="US-ASCII"
Content-Transfer-Encoding: 7bit

Hi,
I am trying to move the decimal point 2 places to the the left.
 
Eg : To make 4536233 into 45362.33
 
I tried this 
$total = "4536233";
$total = sprintf("%0.2f",$total);
print "$total";
But I get this
4536233.00
 
Can anyone help please
 
Regards
Stuart Clark
 

------=_NextPart_000_001D_01C1A834.21827C90--


0
perl
1/28/2002 8:43:54 AM
perl.beginners 29378 articles. 3 followers. Follow

1 Replies
467 Views

Similar Articles

[PageSpeed] 48

Dear Stuart,

The Sprintf function may not be able to change the value of the scalar 
variable $total...its only used to format the value for display...

so dividing by 100 seems to be the only way out...or you could use 
string functions to fetch the substrings and concatenate them with 
decimal in between...

hope this helps...

regs,
sachin balsekar.

Stuart Clark wrote:

>Hi,
>I am trying to move the decimal point 2 places to the the left.
> 
>Eg : To make 4536233 into 45362.33
> 
>I tried this 
>$total = "4536233";
>$total = sprintf("%0.2f",$total);
>print "$total";
>But I get this
>4536233.00
> 
>Can anyone help please
> 
>Regards
>Stuart Clark
> 
>


0
perlmails
1/28/2002 9:26:59 AM
Reply:

Similar Artilces:

How to validate a decimal value with 2 digits after decimal point (de decimal point is a comma)
  I am a newbee, I have a Textbox where de user must write the price of an object. How can I validate de data entry in the Textbox (it must be a valid decimal with 2 digits after decimal point), and my pages are in  Portuguese so the decimal point to be accepted must be a comma   thanks  well you can do something like followig:  suppose TextBox1.Text = 123456,789 then you can say if(TextBox1.Text.Contains(",") ) {     int index1 = TextBox1.Text.IndexOf(",") +1;     int index2 = TextBox1.Text.IndexOf(...

Generate 2 decimal points??? how?
HI All, I use MSSQL as my database and ASP.NET as my front application. I want to display Price value S$23.68. The dayatype I used is smallmoney, but it display: S$23.6800. HOw do I control the number of decimals point in the column of MSSQL??  Thanks a lot  Suigion Well for monetry values i use datatype Decimal(9,2)where 9 is the number of digits before Decimal and 2 is the number of digits that u can use after decimal Pointhope that might helps.....!!Gurpreet Singh Dhaliwal...

2 Decimal point value Problem..
Hi guys, Need help! How to create a DBF table with Floating Point column (2 Decimal Places) in Delphi code? Thanks. Regards, Eric coiner roy wrote: > Hi guys, > > Need help! > How to create a DBF table with Floating Point column (2 Decimal > Places) in Delphi code? Thanks. > > > Regards, > Eric Which Delphi version? Which Database components? No problems with creating other kinds of dbf-tables or columns? Tiedo -- ...

Problem with decimal point in datawindow #2
I have a problem with decimals in a datawindow. -When i use a decimal with editmask #0.00 or #0,00 the number i receive from the datawindow is not a decimal For ex.: dec (datawindow.Object.decimal[1]) = 165 (and not 16.5) I tried to change the settings in the registry in the beginning of my program, because the standard on my computer the decimal sign is a comma. So I change it in the program to a point and at the end of the program back to a comma . I also tried to use an edit field but then i have the same problem. What can i do about this? Thanks Glenn Whic...

Validate 2 digits after decimal point?
Hi, I am wondering what is the best approach to be able to validate a numeric field with 2 digits after the decimal point. Does anyone have a small snippet of code. I can't use the inbuilt validator controls of asp.net, as the textboxes would be generated on the fly. Thanks You can add validator controls on the fly, same as any other control.Jared LivingstonMrLivingston.com - Livingston Family WebsiteTest/Demo site - moonmark.com Hi, Thanks for the speedy reply. I am just trying to write this function, to which I pass the name of the textbox, the validation type such ...

How do i truncate the number from 5 decimal point to 2
Hi. I have a field in the database which float and the value may be 12.12455  When i import the data to my production database and the destination column is on type varchar so how can i just store 12.12 instead of 12.2455   thanks, Karen Hi, does this work for you? select ROUND(12.12455 ,2,1)Thanks,Teemu KeiskiFinland, EU You can convert the column to decimal or numeric with two digits defined: SELECT CONVERT(numeric(12,2),12.12456), CAST(12.12456 As decimal(12,2)) In your SELECT: SELECT CONVERT(numeric(12,2),yourColumn), CAST(yourColumn As decimal(12,2))  FROM...

Floating Point number to 2 decimal places
In T-SQL I am trying to get a floating point number returned converted to 2 decimal places. I have tried an old trick of multiplying by 100 and assigning to an integer variable and then dividing that by 100 again but that only still returns the integer.   There must be a way to do this - can anyone offer any advice? Regards I think you need to convert it to a string with two decimal points. The underlying type, floating point, doesn't really support the concept of limited decimal places.Steve Wellens My blog You can convert your float data to numeric or decimal by u...

Keeping DBEdit value to 2 decimal point
How can I prevent the DBEdit from accepting more than 2 decimal points? I have a situation that the DBEdit gets an amount like 2.675 and at exit, it gets rounded up to 2.68. We need this to alert the user and not round the amount at exit, or not accept more than 2 decimal points to begin with. Any suggestion is appreciated. what about regular expressions? ^[0-9]*[.,]?[0-9]{0,2}$ I haven't test the expression so you have to find it by your self. > {quote:title=Deborah Sassounian wrote:}{quote} > How can I prevent the DBEdit from accepting more than 2 decimal points? &g...

CompareValidator fail if currency value more than 2 decimal point
Does anyone encounter problem using the compare validator against a textbox with operator=DataTypeCheck, type="Currency" and the textbox value contains more than 2 decimal point? With type="Double" it works fine with more than 2 decimal point but must not have comma. Below is my test result: Currency 10,200.20 pass Currency 10,200.204 fail Double 10,200.20 fail Double 10200.204 pass Any suggestion to overcome this issue? Leon ...

how do i keep a value with 2 integers following a decimal point?
 Hi All.I have a number like 0.50 i.e a value representing money in a double variable.However, it loses the last 0 and i am left with 0.5. I am using the formatCurrency function but still no luck. The problem is when i display the value stored, it only displays at 0.5 not 0.50. Any solutions?Thanks  How many parameters are you passing to FormatCurrency()? The second parameter, which is optional, specifies the number of decimal places to display. I looked here: http://msdn.microsoft.com/en-us/library/3352e6f5(VS.80).aspx Try FormatCurrency(moneyAmount, 2) Hope this helps. EDIT...

Stripping decimal points to only 2 places in Repeater Control?
As of now, I am calling up a "Cost" value in a repeater control like: <%# DataBinder.Eval(Container.DataItem, "Cost", "${0:#####.##}") %> That {0:#####.##} does not seem to work properly. As of now, when I just have "Cost" it pulls out 4 places after the decimal point where I only need 2. Can someone help me out with whats the right way to format the value? this is not an direct answer to your q but why dont you fix that problem with the db itself ? so you dont have to worry abt it displaying everytime...also it will save u a hell...

how to round mumeric value upto 3 decimal points in asp 2.0
hi i want to rount numericvalues up to 3 dicimal points in asp 2.0, how can i achive this goal.   If you just want to show this value as string use:  x.ToString("0.000") - to show always three decimals (even they are zero) x.ToString("0.###") - to show only existing decimals - up to three.   If you need it as number - after string conversion - just use Decimal dec = Convert.ToDecimal(x.ToString("0.###"))   Code works in all ASP 2.0 languages Regards,Florin Antoci...

Formatting a decimal to 2 decimal places
Hi - just testing some code, and the code below returns a number with 3 decimal places (eg. 450.000). Will returning a decimal always give 3 decimal places, and if so, how can I remove the last one? I don't want to use: Return String.Format("{0:C}", decRunningTotal) - as that will automatically add a $ or £ or whatever to the start, and I'd like to control that. I'd really appreciate any help, thanks, Mark Function GetItemTotal() As String objDT = Session("Cart") Dim intCounter As Integer Dim decRunningTotal As Deci...

Need to format float with no decimals or decimal point.
Is there a format for float that displays only the integer portion?  Or at the least, integer portion and decimal point but no digits to right? Eval("L_DistCalc", "{0:f}") Thank you, What about this: Eval("L_DistCalc", "{0:f0}")Limno Wow - thanks.  Is there a good reference book that has all the format forms, control structures and properties.  Everything I have has a the essentials but nothing in depth.  I know this kind of thing is simple but is sure is a lot to try and remember. Thank you,  You can sear...

Web resources about - decimal point #2 - perl.beginners

Decimal representation - Wikipedia, the free encyclopedia
Proof: Let , where . Then , and the result follows from dividing all sides by . (The fact that has a finite decimal representation is easily ...

Dewey Decimal Classification - Wikipedia, the free encyclopedia
This highly organized system categorizes books on library shelves in an efficient, specific and repeatable order that makes it easy to find any ...

Fraction Calculator + Decimals to Fractions Converter on the App Store on iTunes
Get Fraction Calculator + Decimals to Fractions Converter on the App Store. See screenshots and ratings, and read customer reviews.

Dewey Decimal Tattoo - Flickr - Photo Sharing!
Children's librarians represent.

Math of the Day: Sesame Street’s The Count Reads Pi to 10,000 Decimal Places
... has created a true monster out of your favorite Sesame Street vampire, with audio of The Count reading every digit of Pi out 10,000 decimal ...

UPDATED: Paul Harapin heads Decimal Software as CEO
Former VCE Asia-Pacific boss, Paul Harapin, has confirmed he is the new chief executive officer (CEO) of Decimal Software.

Feeling green: the dangers of decimal currency
The curious case of possibly toxic coins, via Austria and a devastatingly original idea for Canberra.

Jobless Rates With Another Decimal
The BLS reported a jobless rate of 8.3% for both January and February. Adding an extra decimal, the unemployment rates would actually be 8.26% ...

JPMorgan Sued by Trader Over $3 Million Decimal Point
JPMorgan Chase & Co. is being sued by a trader who says he accepted a contract from the investment bank because a typographical error made him ...

.Decimal Archive - Houston Gamer
It was only back in August when newly-formed Houston game studio Orb Interactive launched a Kickstarter campaign for “.Decimal”, a sci-fi take ...

Resources last updated: 12/26/2015 3:47:35 PM