On Tue, May 24, 2016 at 4:05 PM, Jon Paris <jon.paris@xxxxxxxxxxxxxx> wrote:
I actually checked the manual to be sure I wasn’t mismembering before I responded to your post.
None of us, Corel or you or Chuck, is misremembering the manual entry
for XLATE or %XLATE.
What everyone except Corel and Chuck seemed to be missing (I missed it
too) is that you can use it in a clever (and probably unintended) way.
Just checked your code like so:
Dsply %xlate('1234':'12-3=4':'1234’);
Yeah, that's not how you're supposed to use it, in this case. Read
Chuck's post again carefully. And read the Ted Hold article he linked
to as well, if it's taking more time to sink in.
The idea is that the characters in XLATE's "from pattern" are just
sequential placeholders. In order for the patterns to be longer than
10 characters, it's natural to use letters in sequence. (This also
helps clarify in Ted Holt's use case, which was for dates.)
So the pattern 'ABCDEFGHIJ' just means you have 10 placeholders.
Then your *real input* is XLATE's "to pattern" parameter. Kind of
confusing, because it's not the intended use of (%)XLATE, but stick
with it. Let's say it's a phone number: '8005551212'.
Then your *desired output* is in XLATE's "data to translate"
parameter, which in the phone number case might be '(ABC) DEF-GHIJ'.
Try it. You'll like it. ;)
John Y.
As an Amazon Associate we earn from qualifying purchases.