No announcement yet.

Extracting strings from code

  • Filter
  • Time
  • Show
Clear All
new posts

  • Extracting strings from code

    How can I extract all the strings from my Powerbasic code in order to start a translation into another language? I'm sure that years ago on the forum there was some code suitable for the purpose, which included also the inc files, but I don't find it anymore (surely my problem with English during the search).
    Thank you all for your help.

  • #2
    OPEN "datafile.dat" FOR INPUT AS #1 FILESCAN #1, RECORDS TO count& DIM TheData(1 TO count&) AS STRING LINE INPUT #1, TheData() TO count& CLOSE #1
    The above places the file in an array based on the crlf pairs. You can then manipulate it any way you want with the a home-made text app.

    Another way is to simply load the code into notepad or some other text based app and begin your translation. Do not use word pad or something that puts formating tags in the code.
    Walt Decker


    • #3
      Could be PBCodec, a utility I wrote many moons ago (2003). PBCodec scans all code files and includes, looking for duplicate variable names, etc, and if the check box "Extract string literals" is checked, you also get all string literals listed at the end of the report. Download link:
      Last edited by Borje Hagsten; 14 May 2019, 11:25 AM.


      • #4
        Thanks a lot!