2008/2/13, Johnny Rosenberg <[EMAIL PROTECTED]>:
>
> 2008/2/11, Jonathan Kaye <[EMAIL PROTECTED]>:
> >
> > Johnny Rosenberg wrote:
> >
> > <snip>
> > Hi Johnny and Ariel,
> > Thanks to both of you. Your advice was extremely helpful and I've been
> > able
> > to carry on a fair bit until hitting the next obstacle. The contextual
> > help
> > available in the Macro editor really speeds things up and the methods
> > that
> > Johnny suggests are also the ones I use.
> > Anyway, my next question:
> > Am I correct in thinking that this Basic doesn't distinguish between
> > name
> > assignment and equality testing? It seems that if I right something
> > like:
> > Pet = "dog" it is ambiguous. It could mean, assign the value "dog" to
> > the
> > variable Pet or it could mean a statement that the variable Pet has the
> > value "dog". In the latter case if could be found in an if statement
> > like
> > If Pet = "dog" then
> >         i = i+1
> > end If
> > So i gets increased in value if the statement Pet = "dog" is true.
> > Notice
> > that "=" is used in 2 different ways above.
>
>
> Yes, unlike C and C++ , = is used in both cases and the situation makes
> the difference, kind of.
>
> Now I want to create a While
> > loop of the form
> > While Position = Instr(i, ProcessString, " ")
>
>
> I GUESS (without knowing for sure) that you could make a function that
> returns the value of your InStr statement AND gives that value to the
> Position variable.
>
> Such as:
> While MyInstr(i, ProcessString, " ")
>     blah blah blah
> Wend
>
> function MyInstr(a As Integer, b As String, c As String) As Integer
>     Position=InStr(a,b,c) ' I am not sure if your Position variable is
> available within a function however, but I think it is.
>     MyInstr=Position
> end function
>

Maybe this, if it works, also is a somewhat "ugly" solution…

Johnny Rosenberg

Or something like that, I don't know the exact syntax for InStr at the
> moment.
>
> It appears this doesn't work. I wanted to evaluate the function InStr and
> > assign its value to the variable Position. I can't do that in Basic, I
> > guess. It looks like I have to repeat the Instr expression in the While
> > statement and inside the loop like this:
> > While Instr(i, ProcessString, " ")
> >         Position = Instr(i, ProcessString, " ")
> >         etc. etc. etc.
> > Wend
> > Is this the way I have to do it? It certainly looks ugly.
> >
> > Thanks for putting up with my slowness. I do have a lot of code that
> > works
> > the way I want thanks to your help (both of you).
> > Cheers,
> > Jonathan
> >
> >
> > --
> > Registerd Linux user #445917 at http://counter.li.org/
> > Please do not send me copies of list mail. I read the lists. Thanks!
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>

Reply via email to