Announcement

Collapse
No announcement yet.

REPLACE ANY

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

  • REPLACE ANY

    Why does the message box show

    ef

    when the code below is run?

    Code:
    #COMPILE EXE
    
    FUNCTION PBMAIN() AS LONG
    LOCAL mystring AS STRING
    
    mystring="abcd"
    
    REPLACE ANY "ef" WITH " " IN mystring
    
    
    MSGBOX mystring
    
    END FUNCTION
    Regards,

    Bern


    ------------------
    Bern

    www.insighttrading.com.au
    Bern


    http://www.insighttrader.com.au

  • #2
    With REPLACE ANY the search and replace strings must be the same length. If they are not, errors will occur.

    Code:
    REPLACE ANY "ef" WITH "  " IN mystring
    -- Eric



    ------------------
    Perfect Sync Development Tools
    Perfect Sync Web Site
    Contact Us: mailto:[email protected][email protected]</A>
    "Not my circus, not my monkeys."

    Comment


    • #3
      Eric,

      When all else fails read the documentation. It was there all the time.

      Thanks for that.

      Regards,

      Bern

      ------------------
      Bern

      www.insighttrading.com.au
      Bern


      http://www.insighttrader.com.au

      Comment


      • #4
        I can't think of a single time I've ever used ANY in my code, and since i am never knowing exactly what the string will be, using ANY almost always generates a Dr Watson for me...
        I just never use it, never missed it either...

        ------------------
        Scott Turchin
        MCSE, MCP+I
        Computer Creations Software
        http://www.tngbbs.com/ccs
        Scott Turchin
        MCSE, MCP+I
        http://www.tngbbs.com
        ----------------------
        True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

        Comment


        • #5
          Scott, you must be tilting your head the wrong way when you are writing your code, or using the ANY keyword inappropriately...


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

          Comment

          Working...
          X