473,320 Members | 2,107 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,320 software developers and data experts.

Dynamic formatting of strings

Hi,

Can anyone tell me how to code such that the width field is dynamic? That is
for example, so that the -53 below could be passed in as an integer or
something? I am pretty sure I could do this using one Format call to create
a format string and a second Format call that uses it, but is there a more
elegant solution?
eventstr.AppendFormat(null, "{0}{1,-11} {2,-53}\r\n", eventtime, eventtype,
classmethod);
Michael
Nov 17 '05 #1
1 1417
Michael Lofgren wrote:
Can anyone tell me how to code such that the width field is dynamic? That is
for example, so that the -53 below could be passed in as an integer or
something? I am pretty sure I could do this using one Format call to create
a format string and a second Format call that uses it, but is there a more
elegant solution?
eventstr.AppendFormat(null, "{0}{1,-11} {2,-53}\r\n", eventtime, eventtype,
classmethod);


So far as I know, two Format calls is the way to go.

--

www.midnightbeach.com
Nov 17 '05 #2

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

Similar topics

11
by: Steve Holden | last post by:
I was messing about with formatting and realized that the right kind of object could quite easily tell me exactly what accesses are made to the mapping in a string % mapping operation. This is a...
1
by: J.B | last post by:
I have a datagrid that will display different datasets, (it runs different sprocs based on a value in the querystring) but it will always return 6 columns. The 5th and 6th columns are always Date...
4
by: Robert Manookian | last post by:
How do you format strings? i.e. In VB6: Format("AB34567", "@@@@@-@@") = "AB345-67" In .Net: ????????
1
by: george | last post by:
Hi, I have an app that takes data from a db and maps it to a CSV file. There are multiple maps for different customers which has different formatting rules. For example, some customer wants...
4
by: Ken Wigle | last post by:
All, I would be very grateful for any help on this question. I have an application in asp.net 2.0 where I dynamically create a datatable and then bind that to a gridview. Unfortunately, the...
3
by: sundip | last post by:
Our product is one that is branded for each customer that we sell to. Given that, the name of our product is contained within numerous strings in our string table. Is there a way to have the RC...
9
by: Karthik Gurusamy | last post by:
Hi, The string format operator, %, provides a functionality similar to the snprintf function in C. In C, the function does not know the type of each of the argument and hence relies on the...
6
by: Tomasz J | last post by:
Hello developers, I bind my TextBox control specyfying a format stored in my application global ApplicationContext object - it has a static string CurrencyFormat property. The problem - this...
2
by: Jean-Paul Calderone | last post by:
On Fri, 5 Sep 2008 14:24:16 -0500, Robert Dailey <rcdailey@gmail.comwrote: mystring = ( "This is a very long string that " "spans multiple lines and does " "not include line breaks or tabs "...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.