dotgnu-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [DotGNU]System.Write(System.String,char) missing ?


From: Rhys Weatherley
Subject: Re: [DotGNU]System.Write(System.String,char) missing ?
Date: Thu, 07 Mar 2002 12:20:08 +1000

Open Source wrote:

>    Looks like pnet0.8 System class does not support

What is this pnet 0.8 that you keep referring to?
We are only up to version 0.3.0 of pnet and 0.1.4
of pnetlib.

> Write(System.String,char) method. Since i have no
> access to the CVS, i was wondering whether this method
> is available.

That's because there is no such method in the ECMA spec.

To implement the formatted string writes, it is only
necessary to implement this method in "System.String":

static String Format(IFormatProvider provider,
    String format, params Object[] args);

There should be no need to change anything in either
"System.Console" or "System.IO.TextWriter".  They all
eventually call "Format" in the "String" class.

The code is reasonably simple: create an instance of
"System.Text.StringBuilder".  Then, copy characters
from "format" to the builder, until you come across
a "{???}" reference.  You format the corresponding
member of "args" with this information.  When you
get to the end of "format", call "ToString()" on the
builder, and you're done.

See the ECMA docs for "System.String" for more
information on how formatting works.

Cheers,

Rhys.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]