Quantcast
Channel: Xojo Programming Forum - Latest topics
Viewing all articles
Browse latest Browse all 3768

ReplaceAll too slow

$
0
0

Is there a better way to write this code. It works fine but is extremely slow when processing large sets of data.

Function removeIllegalCharacters(name as string)

dim arrIllegal() as string = array ("\","/",":","?","<",">","*","“","&","@","$","|","%","~")
dim arrReplace() as string = array ("92","47","58","63","60","62","42","34","38","64","36","124","37","126")

dim i as integer
For i = 0 To 13
  name = ReplaceAll(name,arrIllegal(i),"-chr" + arrReplace(i) + "-")
Next

return name

I have a similar function to put the same characters back (also too slow).

7 posts - 4 participants

Read full topic


Viewing all articles
Browse latest Browse all 3768

Trending Articles