Rob B. wrote:
First, damn you for getting me interested in this
Yeah, but it’s guys like you that make the world a happy place. As
you’ve probably seen, I have gotten the program working. However, I
will most definately go through your full example to study it and see
the approach you have taken to solve my problem. I will most likely
ask questions too.
Thanks SO MUCH for taking the time to assist and teach. Are you with
cold beverage distance?
Todd
Todd B. schrieb:
Pit C. wrote:
first, in case you don’t know, you don’t have to terminate statements
with “;”.
Yes, I know. It’s a habit. I write in so many languages where it is
either optional or required, I simply choose to use it all the time.
Sometimes, I don’t know my fingers even added it.
Yes, I thought so, and I wasn’t sure whether I should mention it. Glad
you weren’t offended.
So, are you somewhere were I could buy you a cold beverage? It would be
my pleasure!
Thanks Todd, that would be around 5300 miles… But I will keep your
offer, just in case I’ll happen to visit the States again, so be warned
Regards,
Pit
On 5/11/07, Pit C. [email protected] wrote:
you weren’t offended.
So, are you somewhere were I could buy you a cold beverage? It would be
my pleasure!
Thanks Todd, that would be around 5300 miles… But I will keep your
offer, just in case I’ll happen to visit the States again, so be warned
By coincidence, a French friend just sent me instructions on a cheap
way to travel between US and Europe, instructions are via google:
Step 26 IS a bit intimidating though.
–
Rick DeNatale
My blog on Ruby
http://talklikeaduck.denhaven2.com/
Todd B. schrieb:
Here a whole program that illlustrates the error. I’m running under
Windows Ruby 1.8.5. (it’s ugly and chopped up, but it works… er…
doesn’t work… er… you know what I mean)
Hi Todd,
first, in case you don’t know, you don’t have to terminate statements
with “;”. Second, it’s better to fill $ebcdic_chars and $ascii_chars
once at the beginning of your program and not every time the method
#doit is called.
Now to your problem: for #tr the letter “-” is special. It lets you
define character ranges. See the docs for more info. In order to get a
literal “-” you have to escape it with a “”. The backslash is the
second part of your problem. You have a single backslash both in
$ebcdic_chars and in $ascii_chars, and you have to escape that, too.
One way to fix your code would be to double the line
$ebcdic_chars += 0x5C.chr # *
so that you get two backslashes (0x5C) in a row, change the line
$ascii_chars += ‘-’
to
$ascii_chars += ‘\-’
and finally change the line
$ascii_chars += ‘\’ # escape char is special - must be doubled
to
$ascii_chars += ‘\\’ # escape char is special - must be doubled
Note that ‘\’.size == 1.
Regards,
Pit