Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Why does this code produce these results?

May
855
0
And, more importantly, what can I do about it? The code in question (which has been extracted and cut down from the actual code in question to illustrate the problem) is contained in the attached zip file. And the results of running that code are also in the attached zip file. I apologize for the inconvenience that that causes, but when I put the code (important part being %Index[%CharSetInstr[%I,1,%CharSet]]) inline in a CODE section in this posting, it gets "decorated" for reasons I totally don't understand with open and close EMAIL tags.
So if you look at the (very simple!) code and the (also vey simple!) resulting output, you will see that the code is completely unable to handle the open parenthesis properly. Frankly, I really don't understand (nor care, when you come right down to it) what the open parenthesis means in these circumstances. I just know that the data that I will ultimately be processing will contain open parenthesis.
 

Attachments

  • Sample.zip
    653 bytes · Views: 244
Dan:
When the character selected from CharSet is left parenthesis "(" it confuses the parser. Use %@SafeExp[@Instr[%I,1,%Charset]] - it works!
Another simplification - use the syntax below:
do c in /c %CharSet
@Echo %@SafeEnv[c] %@Index[%Charset,%c]
enddo

Advantages of DO /C vs. FOR:
1/ no need to determine character count in CharSet - automatic (you may use an explicit loop counter)
2/ character of interest is automatically extracted, need not be extracted more than once
3/ DO loops can be debugged via BDEBUGGER, FOR cannot
--
HTH, Steve
 
Thank you Steve, that will do it. (And I understood that it was confusing the parser, I just didn't (and still don't) know why. Not that it really matters.) As far as the "Do" you suggest goes, it's just one more instance in the plethora of capabilities of this product. Sadly for me, there's far more than my limited memory can handle.
 

Similar threads

Back
Top