May 06, 2024, 08:53:34 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


USING command ?

Started by paja, January 19, 2011, 04:42:35 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

paja

Hi,

Can anybody explain USIND command ? In the help file is almost nothing.
I need format number in range 0 to 9999 to 0,00 - 99,99.

Paja

billhsln

In the Help, see:  General Programming, then Formatting Output.  That is where the description is.

Hope that helps,
Bill
When all else fails, get a bigger hammer.

paja

This works OK

def test:string
def test_1:INT
def win_error:window

openwindow win_error,300,150,260,250,@BORDER,0,"DEVICE ERRORS",&hndr

test_1 = 221
test = USING("0####", test_1)
print win_error, test

---------------------------------------------------------------------------

but this will return     0.00  - all digits zero

def test:string
def test_1:INT
def win_error:window

openwindow win_error,300,150,260,250,@BORDER,0,"DEVICE ERRORS",&hndr

test_1 = 221
test = USING("0##.##", test_1)
print win_error, test

LarryMc

Quote from: paja on January 19, 2011, 04:42:35 PM
I need format number in range 0 to 9999 to 0,00 - 99,99.
I believe this does exactly what you asked for:
int x,l,r
x=9999
int l= x/100
int r=x%100
if l < 10
print USING("0#",l)+","+USING("0##",r)
else
print USING("0##",l)+","+USING("0##",r)
endif


LarryMc
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

paja

Larry,

Very nice  !

Thanks