|
On May 24, 2016, at 4:21 PM, John Yeung <gallium.arsenide@xxxxxxxxx> wrote:
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.
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxx for any subscription related questions.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.