Qbasicnews.com
Challenge: International version of PRINT USING - Printable Version

+- Qbasicnews.com (http://qbasicnews.com/newforum)
+-- Forum: QbasicNews.Com (http://qbasicnews.com/newforum/forum-3.html)
+--- Forum: Challenges (http://qbasicnews.com/newforum/forum-10.html)
+--- Thread: Challenge: International version of PRINT USING (/thread-3919.html)

Pages: 1 2 3


Challenge: International version of PRINT USING - Moneo - 05-26-2004

Plasma, you're too much! "It helps to have the source code to Qbasic" :rotfl:

About the currency symbol shakiness, I can't remember now what it was.
*****


Challenge: International version of PRINT USING - Moneo - 05-28-2004

*Well, this challenge is getting as cold as yesterday's mashed potatoes.

Except for Plasma, no one really gives a diddley about the problem.

So, I'm naming Plasma the winner for a brilliant, though different, solution.

Now I'm going to post my simplistic solution.
I'm tired so I'll just walk you through the logic.

I got the idea from a function in Ethan Winer's QuickPak library which allows you to assign the results of a PRINT USING to a variable. So, without using this QuickPak function:

OPEN A WORK FILE FOR OUTPUT TO #2.
USING USING A NORMAL MASK, DO A PRINT USING #2.
Now on file 2 you have the result formatted according to the normal mask.
CLOSE THE WORK FILE, AND READ IN THE FORMATTED RESULT.

NOW, IF YOU WANT TO CONVERT THE RESULT TO EUROPEAN FORMAT, CONTINUE.
USE AN INSTR TO CONVERT THE DECIMAL POINT TO AN "X" CHARACTER, AND USE AN INSTR TO CONVERT THE COMMAS TO A "Y".
This is to distinguish original decimal point and commas.
THEN CONVERT THE X'S TO COMMAS AND THE Y'S TO DECIMAL POINTS.
THEN IF YOU WANT TO DISPLAY SOME OTHER CURRENCY CHARACTER, CONVERT THE DOLLAR-SIGN TO THAT CHARACTER.

Simple, yes. Elegant, well that's a matter of opinion. Many people don't like to use work files. In this case, the work file is 95% of the solution.

Opinions?
*****


Challenge: International version of PRINT USING - SCM - 05-28-2004

Moneo,
It isn't that no one was interested in the challenge, we just weren't looking at it as having a simple solution. nath and I were both considering it as a rewrite of the PRINT USING function.

I like yours. An output and an input isn't real fast, but most of the time it wouldn't be noticable.


Challenge: International version of PRINT USING - Moneo - 05-29-2004

Thanks, SCM, those are exactly my feelings too.
*****