[Mono-list] About Format Function (VB.NET)

A Rafael D Teixeira rafaelteixeirabr@hotmail.com
Tue, 18 Feb 2003 22:28:39 -0300


First a correction:

>   An Spanish developer writes something like :
>
>   if ( Format(myvar,"On/Off" == "Activado" )
>   {
>   	...
>   }

That is not a good pratice anyway, one should always test directly myvar in 
that case.

>   Format has two parameters : first, the object that you want to format
>(numbers,dates, etc), and second (style) an string explaining the format
>(for instance,Format(5,"00") will return the string "05". Well, one of
>the "styles" is "On/Off". MSDN library says that it returns the string
>"Off" if a number is equals to zero,and "On" if  the number is not equal
>to zero.

>I've been testing it using Microsoft .NET, and to my surprise, in my
>spanish  windows box, it returns "Activado" (that means "On" in
>Spanish") and "Desactivado"  ("Off", in spanish).MSDN doesn't say any
>more about this.

>By now, I always return "On" or "Off" (in English), but I would like
>to know if anybody knows any universal symbol, or may be some general
>rules in Mono to do it in one or other way.

These things, are handled either as Microsoft, by using resources, or with 
Mono's GetText look-alike. Never write translating code (blocks of lots of 
if/switch).

>   Any Idea?

Have you checked, if you can only call the Formatting classes already in the 
class library? Most things in this VB.NET library are just wrappers for 
common classes.

Cheers,

Rafael Teixeira
Brazilian Polymath
Mono, MonoQLE Hacker


_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online 
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963