473,395 Members | 1,692 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Number Format

Hi all,

Are there any numeric functions i can use to prepend '0' to all numbers less
than 10?

Currently i am doing this: int Val = (Convert.ToInt32(strTimeValue) < 10 ?
String.Concat("0", strTimeValue) : strTimeValue);

But wonder if the is some number format function that will do this for me?

Any help appreciated!!!
Jul 1 '08 #1
3 1173
Hi,,

System.Math has few of the function that work on decimal or double
i.e. Math.Truncate, Math.Ceiling() and Math.Floor() but those all work
on double or decimal...
what you are asking is operate on integer portion... well i guess you
can write a function of your own

Best of luck

Munna

www.munna.shatkotha.com
www.munna.shatkotha.com/blog
www.shatkotha.com
Jul 1 '08 #2
Try this:

int num = 9;
Response.Write(String.Format("{0:00#}", num));
"Mr Nobody" wrote:
Hi all,

Are there any numeric functions i can use to prepend '0' to all numbers less
than 10?

Currently i am doing this: int Val = (Convert.ToInt32(strTimeValue) < 10 ?
String.Concat("0", strTimeValue) : strTimeValue);

But wonder if the is some number format function that will do this for me?

Any help appreciated!!!
Jul 1 '08 #3
variable.ToString("00")

RTFM

Jul 1 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: martin.mrazek | last post by:
Hello, I wanted to install Number::Format module bud ended up with following error message. Does anybody have any suggestion what the cause could be?? Could that be due to presence of perldl in my...
1
by: Michelle Hillard | last post by:
Hi guys, would appreciate if you can shed some light on this. Sorry to be a pain, can you tell me what is wrong with the following: for /F %%i in ('dir /b /on c:\bcp\pc*.txt') do bcp...
0
by: johkar | last post by:
My XML and XSL is below. Also below is a textual representation of what I want to get out of the XML with XSL. For each Extension node in XML, I am only concerned with those nodes with...
2
by: Richard Haber | last post by:
I am using format-number(-1234.56,'#,##0.00;(#,##0.00)') in a stylesheet that works in every xsl processor (including MSXML2) except for the one in ..NET 1.1. I am expecting to see (1,234.56) as...
13
by: jm | last post by:
I am trying to use datepart to get the real name of the month like "April" or "APR" not just "4." I could not find it in the documentation. Sorry. Thank you.
1
by: crowl | last post by:
Hi all, I want to have a number in a certain format. I took a look in the msdn and was happy to find the format-number Function. This works fine. But unfortunately, I can't find the format...
5
by: Kamaluokeakua | last post by:
I have to write an application that deals with clients in multiple countries. The addresses, phone numbers, country id and currency information has to be stored into a database that allows for the...
6
by: Jovo Mirkovic | last post by:
Hi, I have to make a program which will generate 100,000 different ID numbers (for example 2345-9341-0903-3432-3432 ...) It must be really different, I meen it can not be a similar (like...
6
by: JFB | last post by:
Hi all, How can I format a fax number as 888-333-444? The number is coming from database as 8883334444 <ItemTemplate> <%#container.dataItem("cfax")%> </ItemTemplate> Tks JFB
10
by: Dixie | last post by:
I am appending some new fields to a table in vba and when I append a number field with is a byte, it does not inherit any format. I want it to be the General Number format, but it is blank. I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.