User Tools

Site Tools


substituting_20characters_20in_20a_20string

Substituting characters in a string

by Richard Russell, August 2011

If you want to substitute one character for another in a string (for example you want to change every colon ':' into a dash '-') there's a more efficient and elegant way than looping through each character in turn:

        REPEAT
          i% = INSTR(A$,":")
          IF i% MID$(A$,i%,1) = "-"
        UNTIL i%=0

This is particularly efficient in the typical case when not many characters need to be substituted.

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
substituting_20characters_20in_20a_20string.txt · Last modified: 2024/01/05 00:21 by 127.0.0.1