On 7/1/99 at 8:11 AM, mikonic@... wrote: > > I threw this function together, partly because I might need it but mostly > > for fun. Do you have any suggestions on how it can be improved? > > To make this function more universal, I would suggest turning it into > > 'Length% = FN ReplaceCharsInString (StringPtr&, searchChars$, replChars$) > ' > 'Length% the new length of the string > 'StringPtr& a pointer to a pascal string > 'searchChars$ characters to be replaced > 'replChars$ replacement characters > (a value of ""(empty string) means strip > (delete) all instances of searchChars$) > > Note that LEN(searchChars$) should not have to be the same as > LEN(replChars$) > > With a little work one could also use FN MUNGER() to do the same thing. > Would an assemply line routine be faster than FN MUNGER()? MUNGER works on handles and only handles. That said, it's not that difficult to use. LOCAL FN ReplaceCharsInHandle(hndl&,searchChars$,replChars$) 'replaces every ocurrance of searchChars$ with replChars$ DIM offset& DO offset& = FN MUNGER(hndl&,0,@searchChars$+1,LEN(searchChars$),@replChars$+1,LEN(replChars$)) UNTIL offset& < 0 END FN - via BulkRate