The first three of these statements work. The fourth doesn't.
String::Format("{0}{0}{0}{0}", S"");
String::Format("{0}{1}{0}{0}", S"", S"");
String::Format("{0}{1}{2}{0}", S"", S"", S"");
String::Format("{0}{1}{2}{3}", S"", S"", S"", S"");
Question #1: Why?
Question #2: What is the simplest way to get this to work. I would
prefer to keep this statement on one line as opposed to separate
statements to declare, populate, and use a parameter array variable. 7 1601
"Tommy Vercetti" <ve*********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl... The first three of these statements work. The fourth doesn't.
String::Format("{0}{0}{0}{0}", S""); String::Format("{0}{1}{0}{0}", S"", S""); String::Format("{0}{1}{2}{0}", S"", S"", S""); String::Format("{0}{1}{2}{3}", S"", S"", S"", S"");
Question #1: Why?
Because only the first 3 overloads are declared and defined.
Perhaps you meant to ask why that decision was made. The
threshold had to be established somewhere. Where it is set
now seems reasonable but to know for sure whether it is
optimal would require looking at a lot of code and making
an arbitrary decision about the code space versus execution
time tradeoff.
Question #2: What is the simplest way to get this to work. I would prefer to keep this statement on one line as opposed to separate statements to declare, populate, and use a parameter array variable.
Your dispreferred method is the only way if you insist on a
single call to String::Format(). If you love "single line" enough,
you can concatenate the results of some calls that observe the
3 parameter limitation. Personally, I would consider that to
be honoring a fetish rather than having any real merit.
--
--Larry Brasfield
email: do***********************@hotmail.com
Above views may belong only to me.
Larry Brasfield wrote: Your dispreferred method is the only way if you insist on a single call to String::Format(). If you love "single line" enough, you can concatenate the results of some calls that observe the 3 parameter limitation. Personally, I would consider that to be honoring a fetish rather than having any real merit.
It would be nice if this just worked; after all C has had sprintf and
varargs support for ages. But you are right; this isn't a huge deal by
itself and is fairly easily worked around. The variety of MC++ bugs and
issues that I've had to deal with in the last 24 hours have just made me
a little inpatient.
"Tommy Vercetti" <ve*********@hotmail.com> wrote in message
news:ut**************@TK2MSFTNGP12.phx.gbl... It would be nice if this just worked; after all C has had sprintf and varargs support for ages. But you are right; this isn't a huge deal by itself and is fairly easily worked around. The variety of MC++ bugs and issues that I've had to deal with in the last 24 hours have just made me a little inpatient.
It just works in VC++ 2005 when using the new C++/CLI syntax.
-cd
On Thu, 17 Feb 2005 16:20:44 -0600, Tommy Vercetti
<ve*********@hotmail.com> wrote: Larry Brasfield wrote:
Your dispreferred method is the only way if you insist on a single call to String::Format(). If you love "single line" enough, you can concatenate the results of some calls that observe the 3 parameter limitation. Personally, I would consider that to be honoring a fetish rather than having any real merit.
It would be nice if this just worked; after all C has had sprintf and varargs support for ages. But you are right; this isn't a huge deal by itself and is fairly easily worked around. The variety of MC++ bugs and issues that I've had to deal with in the last 24 hours have just made me a little inpatient.
I haven't been an inpatient since my appendectomy. :)
But I do agree, I find MFC quite infuriating and much more difficult
to code and debug than regular Win32 API coding in C (and C++ where
appropriate).
--
Sev
Severian wrote: But I do agree, I find MFC quite infuriating and much more difficult to code and debug than regular Win32 API coding in C (and C++ where appropriate).
What has this got to do with the original poster's question, which
relates to the .NET framework API?
--
Gerhard Menzl
#dogma int main ()
Humans may reply by replacing the thermal post part of my e-mail address
with "kapsch" and the top level domain part with "net".
On Fri, 18 Feb 2005 09:02:44 +0100, Gerhard Menzl
<ge***********@hotmail.com> wrote: Severian wrote:
But I do agree, I find MFC quite infuriating and much more difficult to code and debug than regular Win32 API coding in C (and C++ where appropriate).
What has this got to do with the original poster's question, which relates to the .NET framework API?
Perhaps you missed the OP's comment in his response:
"The variety of MC++ bugs and issues that I've had to deal with in the
last 24 hours have just made me a little inpatient."
And perhaps I misread MC++ as MFC, too!
--
Sev
Tommy Vercetti wrote: Larry Brasfield wrote:
Your dispreferred method is the only way if you insist on a single call to String::Format(). If you love "single line" enough, you can concatenate the results of some calls that observe the 3 parameter limitation. Personally, I would consider that to be honoring a fetish rather than having any real merit. It would be nice if this just worked; after all C has had sprintf and varargs support for ages.
Yes, the most error prone and dangerous way for string formatting!
But you are right; this isn't a huge deal by itself and is fairly easily worked around.
Using StringBuilder may be an option for building complex strings.
Arnaud
MVP - VC This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: san |
last post by:
Hello, all! I have question about String.Format method.
There are two variants: public static string Format(string, params
object); and public static string Format(IFormatProvider, string, params...
|
by: raffelm |
last post by:
I'm struggling to find a way to include long path names in a command
line argument string that I have to build at runtime.
I need to create a string like -o:"c:\my documents\my file.txt".
...
|
by: Bob |
last post by:
I'm having trouble the string.Format() throwing exceptions and I can't figure
out what I am doing wrong.
Given the following setup code:
string str = { "one", "two", "three", "four" };
double...
|
by: Alpha |
last post by:
Hi, I'm maintaining C# code and am fairly new with C# programming. I'm
looking for codes that's droping the 2nd digit of a nuber printed out and I
suspect it's the code below. Can someone tell me...
|
by: Scewbedew |
last post by:
Suppose I have the following code:
string myFormat = "Line1/nLine 2";
string formattedString = string.Format(myFormat);
....that would produce a 2-line output as expected.
But if I load...
|
by: Lucky |
last post by:
hi guys!
back again with another query.
the problem is like this.
i want to print a line like this:
"---------------------------------------------"
the easiest way is to simply assign it to...
|
by: Remi THOMAS |
last post by:
Hi,
When you execute this line of code
string script = string.Format("foreach (GroupDoc gdoc in
{0}.SetGroup(\"{1}\") {\r\n", "p1", "p2");
You get
System.FormatException was unhandled...
|
by: James |
last post by:
Which is better, which is faster, which is easier etc... ?????
String.Format ( "yadda {0} yadda {1}", x, y )
"yadda" + x.ToString() + " yadda" + y.tostring();
My code has a mish mash of...
|
by: Armando Rocha |
last post by:
Hi,
Hi have a string with 16 chars "25DD68EDEB8D5E11" and i want show it in form
like this "25DD-68ED-EB8D-5E11", i try
String.Format("{0:####-####-####-####}", mystr), but not work, i think...
|
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
|
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...
|
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...
|
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...
|
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: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |