
Fastest way to perform 300 match-replace statements
I haven't written the code for it yet, hence I can't post anything.
I was going to use GetRows because I have read in a gazillion areas that it
is faster for looping purposes than using a recordset.
Something like (really rudimentary, but an example)
Const cThePattern = 0
Const cTheReplace = 1
arMatch = rs.GetRows
For intCount = 0 To UBound(arMatch, 2)
Replace(theText, arMatch(cThePattern, intCount), arMatch(cTheReplace,
intCount) )
Next
How fast would this be for 250 iterations on a string about 10,000
characters in length?
Quote:
> At this time temporarily, looks,
> If you can do without /getrows/, it'll be faster.
> If you can make the file names look like the /pattern/ string, it'll be
> faster.
> However temporary conclusion. Can you show us one or two /passages/ in the
> database, and your code also?
> --
> Han
> Seoul, Korea
> > Replacing with images ... yes ... there are a couple of hundred images
and
> a
> > couple of hundred corresponding patterns. So, search for pattern1 and
> > replace with <img src="whatever.gif"> etc.
> > The list is coming from a database, so it's going to be an array
(getrows)
> > from a recordset.
> > Now, what's the quickest way? Iw as just going to loop through the array
> of
> > pattern/replace with pairs ...
> > > > I've got 300 patterns of characters which - if present in the text -
> are
> > > to
> > > > be replaced with small images.
> > > I'm wondering whether the characters' names are like the images'
names.
> > > e.g.,
> > > I am a <b>boy</b>. You're a <b>girl</b>.
> > > And there are /boy.gif/ and /girl.gif/. In this case replacing will be
> > easy
> > > without loop. I'm not sure whether I'm understanding your question
> > exactly.
> > > In another case, are the images are saved as a blob in database? In
this
> > > case the loop looks inevitable. However I'm not sure of your
condition.