[Gambas-user] I create a new function to share

Pino Zollo pinozollo at ...626...
Fri Jun 26 18:33:40 CEST 2009


Il venerdì 26 giugno 2009 11:34:04 kobolds ha scritto:
> for example
> you need to write program to export data to text file in fix size in
> following format.
> 1. item_no      type:integer    size = 10 character , leading zero
> 2. item name   type:string      size = 20 character, trailing space
> 3. item_qty     type:integer    size = 5 character , leading zero
> 4. item_price   type:float       size = 10 character , 2 decimal , leading
> zero, no thousand and decimal separator
>
> you can easily do this by :
> 1. formatx(item_no , "@n010")
> 2. formatx(item_name, "@s20")
> 3. formatx(item_qty, "@n05")
> 4 formatx(item_price, "@n010vv2")
>  
> you can see that how this function simplify your code that you will need
> more code without it?

Thanks for sharing your code.
Yes I am going to use it into my project as it simplifies my code quite a lot.

Any how I have to solve also the other problem as my code is supposed to be 
used under any 'locale'.

If I get a space in place of a point I can make a work-around...it is actually 
what I have done up to now....

The problem now is with Russian language. The code produces a point as 
thousand separator, but the form and the console of GAMBAS show two 
squares...i.e. 2 not recognised utf-8 characters.

You can test it making a test user on your system and put into his .profile 
the command
LANG="ru_RU.utf8"

and run your program as this user.

Best regards

Pino

 



-- 
Key ID: 0xF6768208 
Key fingerprint = B16D 0A7C 5B29 A334 CE6A  71F6 EAF8 3D88 F676 8208
Key server: hkp://wwwkeys.eu.pgp.net




More information about the User mailing list