Flasher Archive

[Previous] [Next] - [Index] [Thread Index] - [Previous in Thread] [Next in Thread]


Subject: RE: [flasher] HELP~~!!! ~~ Any Flash 5'ers out there~~!!!
From: Patrick McNeil
Date: Tue, 20 Feb 2001 16:37:18 -0000

I used the following code. But it does not include the decimals. It assumes
a string with no decimals. Would be a good starting point I suppose. The
code I got it from was original posted with a decimal handler, but it was
flash 4. See it below

Flash 5 (no decimals):

// Comma Parser, just pass in variable "input", and use returned variable
"formatted"
formatted = "";
i = 0;
while (i < length (math.floor(input)) -1) {
formatted = substring ( input, length (math.floor(input)) - i, 1) add
formatted;
temp = math.floor ((i+1)/3);
temp2 = (i+1)/3;
if (temp == temp2) {
formatted = "," add formatted;
}
i = i + 1;
}
formatted = substring (math.floor(input), 1, 1) add formatted;
formatted = "$" add formatted;

Flash 4(with decimals):


Set Variable: "subInput" = (input - Int (input) + .005) * 100
Set Variable: "subInput2" = Int (subInput) / 100
Set Variable: "formatted" = ""
Set Variable: "i" = 0
Loop While (i < length (Int (input)) - 1)
Set Variable: "formatted" = Substring (input, length (Int (input)) -
i, 1) & formatted
If (Int ((i + 1) / 3) = (i + 1)/3)
Set Variable: "formatted" = "," & formatted
End If
Set Variable: "i" = i + 1
End Loop
Set Variable: "formatted" = Substring (Int (input), 1, 1) & formatted
If (length (subinput2) = 3)
Set Variable: "formatted" = formatted & Substring (subInput2, 2, 3) &
"0"
Else
Set Variable: "formatted" = formatted & Substring (subInput2, 2, 3)
End If

Hope this helps.

Patrick




[Previous] [Next] - [Index] [Thread Index] - [Next in Thread] [Previous in Thread]