CompuServe Thread

#Lower()?

12 messages in this thread
#43321From: SyndesisOct 20, 1994 10:53 PM
Does anyone have a handy ARexx subroutine for converting a string to lowercase? I'm looking for the opposite of upper(). I tried using lower() in a script, but I saw a message about "invalid message" and then crashed…
#43336From: Bill HawesOct 21, 1994 7:04 AM
John, There isn't a built-in lower function in ARexx, but you can use the translate() function to do the conversion. For example, say translate("ABC","abc","ABC") [D [D [D [D [D [D You'll need to list the characters you want translated, including the high-range ASCII characters if these will occur in your text as well. -Bill
#43338From: SyndesisOct 21, 1994 8:20 AM
Yes, I know about translate(), I was hoping for something simpler.
#43340From: Jim ButterfieldOct 21, 1994 11:42 AM
say trnaslate('Hello Sailor!',xrange('a','z'),xrange('A','Z')) I suspect that UPPER() is in common use in trying to match strings case-independently (change them both to UPPER). A LOWER function wouldn't be needed for this, since UPPER would do the whole job. –Jim
#43348From: SyndesisOct 21, 1994 5:58 PM
Ah, yes, xrange() is what I was looking for. Sheesh, I wish I had a Rexx for Windows or NT or Unix… It's easier than shell-ish. I think Hawes should make his next million by making an Amiga-like variant of Rexx for Windows. I get the feeling the other commercial Rexx are more IBM-centric, descended from mainframe Rexx.
#43384From: Jim ButterfieldOct 22, 1994 8:23 AM
Yes, Rexx is neat in many ways (literally neat, too, where it gives back resources when your program terminates). The manual may put some people off. Arranging things in alphabetical order starts you off with ADDRESS, not the best first-instruction-to-try (my choice for beginners would be PULL and SAY, followed by DO..END and then IF..THEN..ELSE). And PARSE (a relatively easy command to use) takes up so many pages that, the first time I tried the manual, I thought that I'd reached the end of the instructions. "Using ARexx on the Amiga" (Zamara/Sullivan) is a nicely-organized guide to the language. Its two main sections are tutorial and reference, which takes care of both learning and looking things up. It has always bugged me that ARexx has the false reputation of being for inter-process communications only. In fact, it's an elegant language for stand-alone use. I wish it had been around in those long-ago days when everybody was falling into Microsoft Basic. Yes! Rexx for Windws! Heck, even for MS-DOS! (Anybody want to try to retrofit it to the Commdore 64?) –Jim
#43392From: SyndesisOct 22, 1994 11:16 AM
Uhm, Jim, we have to do something to get you pointed in the right direction, market- and profit-wise. 🙂 Commodore 64 Rexx???
#43420From: Malcolm O'BrienOct 23, 1994 1:20 AM
Jim (& John), The Windows gods have already decreed that the language shall be BASIC. But there _is_ REXX for OS/2 and for DOS. I'll post your vote for C64 REXX in CBMAPP. 🙂 Malcolm
#43432From: Jim ButterfieldOct 23, 1994 8:45 AM
Yes, it's interesting to see how the MS-DOS editor EDIT is in fact interlocked with QBASIC .. in fact, you can't have one without the other. (Back to EDLIN? NEVER!!). Whereas PC-DOS had to produce its very own editor in competition .. claimed to be superior, but I can't really tell from the brief runs I have had on each. But for certain jobs, QBASIC is clumsy indeed. Wanna trim a line of text to less than 80 characters, breaking it at the space which precedes position 80? Lotsa luck in QBASIC ("FOR J=80 TO 1 STEP -1 …) Whereas in Rexx, find that space with X=LASTPOS(' ',string,80) and you're in business! –Jim
#43430From: Alex GianOct 23, 1994 6:28 AM
John I the used the follwing "cute" hack for obtaining a lower(string): BITOR(string) !! this works by exploiting the fact that the BITOR() function defaults to BITORing with the blank, or space caracter " ". This is hex 20 in ASCII, which is also the distance that separates upper and lowercase characters. However, this also means that it *only* works for alphabetic characters and blanks, and will produce garbage for other characters (e.g. %,$,",numbers etc.). So in the long run TRANSLATE() is much more robust. Alex
#43433From: Jim ButterfieldOct 23, 1994 8:45 AM
Hey, that's not only CUTE, but CLEVER. (Although any time I try a trick like that, I usually end up outsmarting myself. As they say, "Computers are dumber than people, but smarter than programmers"). –Jim
#43444From: SyndesisOct 23, 1994 4:05 PM
I'd venture that a lot of people were using that for the equivalent of the missing LOWER() function!