Format() is grasshopper is similar (in fact, it delegates)
System.String.Format() in the DotNET framework.
An example of advanced features would be:

Format("Number = {0:0.00}    (Real Value = {0:R})   Scientific =
{0:E}", x)

Everything inside the curly brackets will get formatted, in the above
case, there is only a single variable provided (x), so you can only
have {0}.
However, you can add formatting hints between the index and the
closing bracket, using the colon. Thus: "{0:0.00}"  will round a
floating point value to 2 decimal places. Or "{0:0.00##}" will round a
floating point value to 4 decimal places, but it won't include the
last two digits if they are zero. There are also special formatting
codes such as "{0:R}" or "{0:E}", the first one will ensure that no
precision is lost when formatting the floating point number, the
second one forces scientific notation. The above example gives (for x
= 0.5329087):

"Number = 0.53    (Real Value = 0.5329087)   Scientific =
5.329087E-001"

There are many other numeric formatting codes available.
See:
http://msdn.microsoft.com/en-us/library/dwhawy9k.aspx
http://msdn.microsoft.com/en-us/library/0c899ak8.aspx

Formatting also works for date and time structures, and many other
variable types.

general information:
http://msdn.microsoft.com/en-us/library/txafckwd.aspx


--
David Rutten
Robert McNeel & Associates


On Oct 27, 7:30 pm, CMC <[EMAIL PROTECTED]> wrote:
> Does anyone know where you can find a deep explanation of the Format()
> function?
> In one of the definitions I've downloaded it says " The F(x) component
> formats the incoming data using some advanced features of the Format()
> function.": I'd like to understand more about the so called advance
> features in order to be able to customize the output.
> THX
>
> cmc

Reply via email to