Re: Challenging text masking problem

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Larry Serflaten (serflaten_at_usinternet.com)
Date: 11/15/04


Date: Sun, 14 Nov 2004 20:10:03 -0600


"exekutive" <exekutive@discussions.microsoft.com> wrote
> I wrote that in there because I know there are always those people out there
> who are so sure of themselves and post things they think work but they've
> never actually tried for themselves which makes it completely useless. For
> example, saying it is a "simple substitution" is useless. Do you think that
> it had not occured to me? The dictionary idea might be helpful if I knew
> what that was.

How much effort are you willing to put into finding a solution? If you put
no more effort into it than asking someone else to do it for you, you are not
going to see many responses. There are several search engines on the net that
will help you find working code examples, and help you learn what a Dictionary
object is. If you want code handed to you, go find it on the net. A Dictionary
is similar to a Collection but with a few major differences.

> I have tried several approaches now and didn't get far with them, often
> running into the problem of needing arrays of unknow dimension. My current
> idea is this: use a recursive function that uses the string.indexOf method to
> create an array of integers representing the positions of %x tokens. The
> rest is not clear yet but will involve matching the strings surrounding the
> tokens in the mask to the input string.

I gave you an indication of how it could be done:

"I'll be interested in seeing who will decide to help out beyond simply stating you
have to split them up into words and use a dictionary to subsitute in the needed
parts.... "

Look up Split in VB help. It returns an array. So you split up the two input
strings which turns them into array of words. Loop through the arrays looking
for your %x tokens and associate the token of one array with the word from the
other array. How you associate them is up to you, you could use a dictionary or
a collection.

When you split the output string into an array, all you need do is loop through
that array looking for those %x tokens and substitute the associated word for
that token. When the loop is finished, you can use Join to put it all back into
a string for output. See Join in VB Help for examples of its use.

The newsgroups are not your personal developer resource, no one is paid anything
to participate. Most are here to share knowlege not give away code although,
code examples are a concise method often used to convey certain knowlege.
You are expected to research the problems and try to solve them yourself. You'll
find you will get many more responses if you post the code you've tried that
doesn't quite get the job done, instead of demanding that you want the entire task
completed, and only certain responses be allowed. As you've found out, no one
is obligated to post any code whatsoever, and if it appears you are not putting
much effort into solving the problem yourself, why should anyone else bother
putting more effort into it than you? Try the solution suggested, see how far you
get, and if you have problems, create a _small_ demo to show the problem so that
others can copy and paste your code and try it out to see it on their system. They
are much more likely to fix your code, rather than create a complete solution from
scratch.

LFS

  

 



Relevant Pages

  • RE: Error 3021
    ... Create proto-file names using the selected job names and storre to an array ... Save and close the document and repeat the loop ... Dim strJobsAs String, strDocsAs String, varValsAs _ ...
    (microsoft.public.access.modulesdaovba)
  • RE: Error 3021
    ... Kevin Backmann ... Create proto-file names using the selected job names and storre to an array ... Save and close the document and repeat the loop ... Dim strJobsAs String, strDocsAs String, varValsAs _ ...
    (microsoft.public.access.modulesdaovba)
  • RE: Error 3021
    ... Create proto-file names using the selected job names and storre to an array ... Save and close the document and repeat the loop ... Dim strJobsAs String, strDocsAs String, varValsAs _ ...
    (microsoft.public.access.modulesdaovba)
  • RE: Error 3021
    ... Create proto-file names using the selected job names and storre to an array ... Save and close the document and repeat the loop ... Dim strJobsAs String, strDocsAs String, varValsAs _ ...
    (microsoft.public.access.modulesdaovba)
  • Re: Optimization question
    ... PROCEDURE ForOptimize*(s: ARRAY OF CHAR); ... Calling this with a 75-character string yielded "31" for both loops. ... the sentinel null character. ... With C's "for," you define how you continue the loop, which can be (and ...
    (comp.lang.oberon)