Announcement

Collapse
No announcement yet.

How to use REPLACE with -->CHR$(9,9,9)+"<key>Size</key>

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

  • How to use REPLACE with -->CHR$(9,9,9)+"<key>Size</key>

    HOW TO USE REPLACE WITH -->CHR$(9,9,9)+"<key>Size</key>
    REPLACE ANY causes ERROR 5 illegal function call

    error goes away if REPLACE ANY CHR$(9) WITH "x" IN INPUT_STRING but no x is found in INPUT_STRING
    error goes away if REPLACE CHR$(9) WITH "" IN INPUT_STRING --> (CHR$(9,9,9)+"<key>Track ID</key><integer>2829</integer>")

    Trying to get rid of $CHR(9,9,9)


    Code:
         DO WHILE NOT EOF(1)
          INPUT_STRING = TRIM$(INPUT_STRING)
    
          REPLACE CHR$(13) WITH "" IN INPUT_STRING
          REPLACE CHR$(10) WITH "" IN INPUT_STRING
          REPLACE ANY CHR$(9) WITH "" IN INPUT_STRING
          LINE INPUT#1, INPUT_STRING
          PRINT INPUT_STRING
         WEND

  • #2
    In Replace with ANY, both input and replace string need to be same length, but if goal is to remove, try using REMOVE$ instead:
    Code:
      INPUT_STRING = REMOVE$(INPUT_STRING, ANY CHR$(9, 10, 13))

    Comment


    • #3
      Also, the location of your LINE INPUT#1 is overwriting any changes you have made with REPLACE. All that block of code will do is print unmodified strings from the file.
      "Not my circus, not my monkeys."

      Comment


      • #4
        DO/LOOP with a condition of WHILE
        or
        WHILE/WEND
        for syntax stated in Help.
        (I did not check if DO/WEND would compile or run, just the syntax)

        Cheers,
        Dale

        Comment


        • #5
          If what you have are 3 tab characters inline that you want to remove or replace, why would you loop through the text file on a line by line basis ? Either REPLACE or REMOVE$ are fast on a non defined file type (IE: treated like a binary file) so unless you have a reason to read the file line by line, do it directly on the full file.

          Here is a simple test piece.
          Attached Files
          hutch at movsd dot com
          The MASM Forum

          www.masm32.com

          Comment


          • #6
            ? to print without tab characters without changing the file? (original formating for other puposes)

            Cheers,
            Dale

            Comment


            • #7
              Thanks guys!
              Borje got the prize with REMOVE$()
              OY! I should have thought of that.

              Comment

              Working...
              X