home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.rexx
- Path: sparky!uunet!cs.utexas.edu!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!csn!stortek!LSTC2VM.stortek.com!MCMASTER
- From: MCMASTER@LSTC2VM.stortek.com (Jim McMaster)
- Subject: Re: Lower-case alphabetic set
- Message-ID: <16B50D45D.MCMASTER@LSTC2VM.stortek.com>
- Sender: usenet@stortek.com
- Nntp-Posting-Host: lstc2vm.stortek.com
- Organization: StorageTek SW Engineering
- References: <REXXLIST%93010320580660@OHSTVMA.ACS.OHIO-STATE.EDU> <C0CDCz.Co3@csfb1.fir.fbc.com> <C0E55F.IK5@csfb1.fir.fbc.com> <16B4E7C5F.MCMASTER@LSTC2VM.stortek.com> <C0Hr59.70x@csfb1.fir.fbc.com>
- Date: Fri, 8 Jan 1993 22:06:03 GMT
- Lines: 103
-
- In article <C0Hr59.70x@csfb1.fir.fbc.com>
- jbrock@csfb1.fir.fbc.com (John Brock) writes:
-
- >In article <16B4E7C5F.MCMASTER@LSTC2VM.stortek.com>, MCMASTER@LSTC2VM.stortek.com (Jim McMaster) writes:
- >|> In article <C0E55F.IK5@csfb1.fir.fbc.com>
- >|> jbrock@csfb1.fir.fbc.com (John Brock) writes:
- >|>
- >|> >In article <C0CDCz.Co3@csfb1.fir.fbc.com>, jbrock@csfb1.fir.fbc.com (John Brock) writes:
- >|> >|> In article <REXXLIST%93010320580660@OHSTVMA.ACS.OHIO-STATE.EDU>, Wan Hasan Abdullah <WAN@UTMJB.BITNET> writes:
- >|> >|> |> Hello netters!
- >|> >|> |>
- >|> >|> |> I found that, there's a function to translate all words to upper case
- >|> >|> |> but I could'nt find in HELP REXX to form the words from upper case to
- >|> >|> |> lower case by using a function. Could anyone help me to solve this
- >|> >|> |> problem?
- >|> >|> |>
- >|> >|> |> Thanks in advance.
- >|> >|> |>
- >|> >|> |> -WAN-
- >|> >|>
- >|> >|> How about:
- >|> >|>
- >|> >|> lowercase: procedure
- >|> >|> return translate(arg(1), xrange(), translate(xrange()))
- >|> >|>
- >|> >|> I like this because it is consise and generic. It should work as it
- >|> >|> stands for any language, and it lets me avoid typing out all the upper
- >|> >|> and lower case letters by hand (which I think looks ugly, even though
- >|> >|> it's clearly more efficient to do it that way).
- >|> >
- >|> >I'm responding to my own post, as there have been other posts
- >|> >expressing concern about this type of procedure translating
- >|> >non-alphabetic characters.
- >|> >
- >|> >On my system at least, all non-alphabetic characters are unchanged by
- >|> >the translate function when used with only one argument. If this isn't
- >|> >part of the language definition it ought to be! In any case you could
- >|> >argue that if c ^== translate(c) for any character c, then c by
- >|> >definition has a distinct upper case form, and my lowercase function
- >|> >makes sense.
- >|> >
- >|> >It even makes a certain kind of sense if translate is generalized
- >|> >(e.g., mapping a ==> b, b ==> c, and c ==> a), an long as it never maps
- >|> >two distinct characters to the same character.
- >|> >
- >|> >Here is a procedure which checks which characters on a given system
- >|> >are affected by the translate function:
- >|> >
- >|> > x = xrange()
- >|> > y = ""
- >|> >
- >|> > do i = 1 to length(x)
- >|> > c = substr(x, i, 1)
- >|> > if c ^== translate(c) then y = y || c
- >|> > end
- >|> >
- >|> > say length(y) y
- >|> >
- >|> >On my (VM/CMS) system this yields:
- >|> >
- >|> > 26 abcdefghijklmnopqrstuvwxyz
- >|> >
- >|> >--
- >|> >John Brock
- >|> >uunet!csfb1!jbrock
- >|> >jbrock@csfb1.fir.fbc.com
- >|>
- >|> John...this does not work in the general case. Your "translate(c)"
- >|> uses the default translate tables, which are designed to translate only
- >|> lower case alphabetic to upper case alphabetic.
- >|>
- >|> The input table "xrange('A','Z')" and output table "xrange('a','z')"
- >|> are not at all the same. You certainly will translate "A" (x'C1') to
- >|> "a" (x'81'), but you also translate the backslash (x'E0') to the EBCDIC
- >|> superscript character (X'A0'). EBCDIC has a lot of characters
- >|> (printable and nonprintable) between the letters I and J, as well as
- >|> between R and S, which will also get translated.
- >|>
- >|> Your technique would work in an ASCII system, bacause all upper-case
- >|> alphabetics are in the range X'41'-X'5A' (with no intermixed
- >|> characters), and lower-case alphabetics are X'61'-X'7A'.
- >|>
- >|> Jim McMaster
- >
- >I'm sorry, but I don't understand your objection. What I demonstrated
- >above is that (at least on my VM/CMS (EBCDIC!) system) the only
- >characters affected by the translate function are the lower case
- >alphabetic characters. So it doesn't matter that my lowercase
- >procedure translates non-alpha characters, because it translates them
- >to themselves, leaving them unchanged. My function does not, as you
- >stated, change x'E0' to x'A0', at least not on my system. Try it! Am
- >I missing something?
- >
- >--
- >John Brock
- >uunet!csfb1!jbrock
- >jbrock@csfb1.fir.fbc.com
-
- This is my public apology for misreading your technique. You are
- correct, and it does work. A large number of synapses must have
- misfired when I read your post.
-
- Jim McMaster
-