splitting a number

1. Senior Member
Join Date
Dec 1969
Posts
175

## splitting a number

I have a total figure "192.68" I want to split the figure into two eg. Dollars = 192 and cents = 68 how wd I do that

2. Senior Member
Join Date
Dec 1969
Posts
731

## RE: splitting a number

can we do something like<BR><BR>&#060;%a=split(CSTR(192.68),".")<BR><B R>for i=0 to ubound(a)<BR>Response.Write a(i)<BR>next<BR>%&#062;

3. Senior Member
Join Date
Dec 1969
Posts
175

## so how wd I response.write?

I want 2 break up the figure and state<BR>dollar = 192<BR>cents = 68<BR><BR>I have a page where in I have 2 display the currency<BR>dollars = x<BR>cents = y<BR><BR>how wd I do that?<BR><BR><BR><BR><BR>

4. Senior Member
Join Date
Dec 1969
Posts
731

## easy...

i assume as as per rules u will have only one "." in a currency right?<BR><BR>so u split the variable in to the array variable and no need to loop the array...<BR><BR>just say<BR><BR>dollar=a(0)<BR>cent=a(1)<BR><BR>after the split<BR><BR>

5. Senior Member
Join Date
Dec 1969
Posts
402

## international....

what happens if the decimal / thousand sep chars are different? would it be better to use Fix?<BR><BR>ie: x = -99.2\$<BR><BR>n(0) = FormatNumber(Fix(x), 0)<BR>n(1) = FormatNumber(Abs(x) - Fix(Abs(x)), 2)<BR><BR>jb

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•