Announcement

Collapse
No announcement yet.

PARSECOUNT wrong?

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

  • PARSECOUNT wrong?

    The PARSECOUNT function seems to give a
    result 1 too large in the following program.
    Is this a known problem or simply a
    definition error in the documentation?
    ---------------------------------------------
    #COMPILE EXE
    FUNCTION PBMAIN() AS LONG
    TEXT$="AAAA"
    PRINT PARSECOUNT(TEXT$,"A")
    PRINT PARSECOUNT(TEXT$,"B")
    PRINT PARSECOUNT(TEXT$,"")
    END FUNCTION

  • #2
    Code:
    TEXT$="AAAA"
    PRINT PARSECOUNT(TEXT$,"A")
    This will return 5, because there are 4 "separators" which means that there are 5 "fields", hence PARSECOUNT will correctly return 5.

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

    Comment


    • #3
      Sorry I raised it, Lance. The documentation is unambiguous.

      The examples in the manual for PARSECOUNT
      should be fixed; they are the same as for
      the PARSE$ function and obviously wrong.

      Comment

      Working...
      X