Yes, Doug has a good way of thinking of things.
You probably recognise / as the division operator.
The \ is the integer division operator.
You can see the difference if you open the Immediate Window (Ctrl+G) and
enter:
? (8 - 3) / 3
? (8 - 3) \ 3
The first returns 1.6 recurring. The second performs integer division, so
just returns 1.
Len() always returns integers, and the number of characters difference
should be an exact multiple of the number of characters to find, so there
should not be any difference between the result of integer division or
normal floating point division. There could be a slight performance
difference, i.e. integer division could be faster.
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users -
http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"MLH" <CR**@NorthState.netwrote in message
news:93********************************@4ax.com...
Douglas j.Steele contributed Wed, Aug 11 2004 6:15 pm.
Replace$ is not available in A97. Chuck Grimsby took care
of that with his airing of the JoeReplace FN.
My Q here today is to Doug, in regard to the use of the backslash...
Is there ever an instance where
CountInstances = (Len(ToSearch) - Len(JoeReplace(ToSearch, ToFind,
vbNullString))) \ Len(ToFind)
would return a value different than
CountInstances = (Len(ToSearch) - Len(JoeReplace(ToSearch, ToFind,
vbNullString))) / Len(ToFind)
???
If not, is the wisdom behind the backslash just to produce result that
is one of the 3 Types returned by the backslash? This one-liner, BTW,
is one of my all time favorites. The simplicity of it is staggering.
Thanks again, three years later, for your excellent contribution.