12-30-2022, 12:58 PM
I often end up using custom approaches to this depending on the situation.
When your string is very long (>1MB) performance very much depends on how you build up the new string.
- You can walk over the input-string and per character decide if you add it to the result-string
- Per character to remove, you can search (instr) and replace in a loop
- You can use _memcopy to copy all parts between characters you want to remove
- Or if possible the best: Use the original string in your processing and skip characters not wanted. This prevents in memory copying.
When your string is very long (>1MB) performance very much depends on how you build up the new string.
- You can walk over the input-string and per character decide if you add it to the result-string
- Per character to remove, you can search (instr) and replace in a loop
- You can use _memcopy to copy all parts between characters you want to remove
- Or if possible the best: Use the original string in your processing and skip characters not wanted. This prevents in memory copying.
45y and 2M lines of MBASIC>BASICA>QBASIC>QBX>QB64 experience