473,385 Members | 1,782 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,385 software developers and data experts.

iValue.ToString("###########0",CultureInfo::Curren tUICulture));

A question: (C#, C++)

If I use iValue.ToString("000000000000",CultureInfo::Curren tUICulture));
The I get a string with a fixed lengt if format: "000000542663"

But since I want the leading "0" gone, but still have the fixed string
length I replaced it with this:
iValue.ToString("###########0",CultureInfo::Curren tUICulture));

But to my suprise I get "542663" while I expected : " 542663" (note the
missing spaces)

Can someone tell me how to keep these leading spaces fixed because I need
them to create a grid of numbers as text output.
I cannot find it in the documentation.

---
http://www.skyscan.be
Nov 16 '05 #1
2 3743
Try
iValue.ToString().PadLeft(12, ' ');

--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Olaf Baeyens" <ol**********@skyscan.be> wrote in message
news:41***********************@news.skynet.be...
A question: (C#, C++)

If I use iValue.ToString("000000000000",CultureInfo::Curren tUICulture));
The I get a string with a fixed lengt if format: "000000542663"

But since I want the leading "0" gone, but still have the fixed string
length I replaced it with this:
iValue.ToString("###########0",CultureInfo::Curren tUICulture));

But to my suprise I get "542663" while I expected : " 542663" (note
the
missing spaces)

Can someone tell me how to keep these leading spaces fixed because I need
them to create a grid of numbers as text output.
I cannot find it in the documentation.

---
http://www.skyscan.be

Nov 16 '05 #2
> Try
iValue.ToString().PadLeft(12, ' ');


Nice. :-)
--
http://www.skyscan.be
Nov 16 '05 #3

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

Similar topics

2
by: sfdgkjhldsfg | last post by:
Hi, This is driving me nuts, hopefully someone here can put me out of my misery. I'm generating a web page with drop down combo boxes, and I want one of the values to be automatically...
6
by: Gerry Abbott | last post by:
Hi all, Have written some code to limit the concurrent users of a database. Use the Autoexec macro to open a form. When the form opens it increments a value in a table. When the form closes...
4
by: Mark Hollander | last post by:
Hi, Is there an easier way to convert a UInt16 to Int16 than the way I am currently doing it Dim iValue As Int16 Dim uValue As UInt16 Try uValue = GetValue(WMI.NetworkAdapter,...
6
by: Col | last post by:
Hi - I've never worked with list boxes before. Here's what I'd like to do - have a list box (or some other control) that allows multiple selection and stores all the values in one field (can be...
2
by: Harry Strybos | last post by:
Hi All I have a form with about 20 check boxes and I want to persist their state to a single integer. That is to say, I want to set their Checked property to a particular bit value contained in...
23
by: Jonathan Wood | last post by:
I was wondering if some of you could advise me on the following issue. I ported my code that generates shareware licenses to a C# class. I'd like to get to the point where this is done online...
1
by: Smalley | last post by:
Need some help please. Have this code and for some reason it is not working correctly. I am not receiving errors, just the table is not being populated at all. I have created the tbl and the frm...
2
by: VictorTan | last post by:
Hello. I'm new to this forum. Hope that I don't make mistakes in here but if I do, please correct me if there is. Thanks. I also wanted to ask you guys regarding about the following following...
21
by: Christian Meier | last post by:
Hello NG I have the following code: file1.h: static const int iValue = 5; <EOF>
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...

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.