Announcement

Collapse
No announcement yet.

Format$

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Format$

    I have been porting a large VB program over to PB and I have ran into a significant problem. In VB, the "Format" function allows the user to input a robust set of format strings which include dates and time. In PB the format$ function is much more modest. Is there any built-in support for date and time formats in PB? Also the PB 1.0 documentation shows format$ having support for scientific notation. In PB6, there is no such documentation. Does the format$ function in PB6 support scientific notation? Preliminary testing I have done seems to treats the E+,e+ as a string literal. Any help or a work around would be greatly appreaciated!

    Thanks,


    Jeff

    BTW, how to people insert those different face characters in their messages?

  • #2
    FORMAT$ does not support Date, Time or scientific format codes. The documentation for FORMAT$ in PB/DLL 5.0 was incorrect in that it stated scientific format was supported.

    There are examples of date and time formatting (and conversion routines)... take a look through the Source Code Forum, or use the BBS search link. Alternatively, you could construct a function that performs a customized formatting string. The Win32 API includes some date formatting functions too.

    There are links to the smilies and UUB code legends to the left of the "message body" text box... take a look next time you write a message.

    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    Lance
    mailto:[email protected]

    Comment


    • #3
      Lance,

      while we're at it:
      I would like to see that FORMAT$ respects the local settings fot the decimal/thousander separator.

      Don't get me wrong here: I don't care entering a "." in code when using floating point numbers. But I consider the FORMAT$ function a "tool" to visualize a result. I find it annoying to format a number with FORMAT$ and then need to swap commas and dots within that string. In PB/DOS this can be done by pbvUsingChars. Is there something similar in PB/DLL and/or PB/CC that I haven't seen yet?

      Knuth

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

      Comment


      • #4
        Nothing as it stands today in PB/DLL or PB/CC. As you note, using REPLACE is a simple technique to produce the correctly localized string.

        I know that there are some internationalization ideas such as this already on the "wish list".



        ------------------
        Lance
        PowerBASIC Support
        mailto:[email protected][email protected]</A>
        Lance
        mailto:[email protected]

        Comment


        • #5
          Lance,

          FYI, it appears that the percent format, which is in the PB/DLL 6 documentation doesn't work either . Basically FORMAT$ just works with numbers. As much as I like PB, situations like this can prevent people making sucessful transitions from VB. The VB format function will format dates, time, weeks, days, years, percent, currency, scientific and so on. Although I can write code to do for these functions, it will be very time consuming. Especially since I didn't plan on it. I will search for any existing code which can help. However I think that the FORMAT$ function should at least provide basic date and time formatting functions. At very least, the function should handle the currently documented features. Please add this to the wish list.
          Thanks for the help,

          Jeff


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

          Comment


          • #6
            Notes on the issues with FORMAT$() operation and it's documentation have been sent to R&D and acknowledged. Thanks!


            ------------------
            Lance
            PowerBASIC Support
            mailto:[email protected][email protected]</A>
            Lance
            mailto:[email protected]

            Comment

            Working...
            X