Reginald: How to make a string lower case?

This is a discussion on Reginald: How to make a string lower case? within the REXX forums in Programming Languages category; Quercus Rexx has both an upper() function and a lower() function built into the language. Reginald does not seem to have either. It does have the UPPER instruction, but no LOWER instruction. Is there a better way to convert a string to lowercase than using translate()? A2ZUpper = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' A2ZLower = 'abcdefghijklmnopqrstuvwxyz' a="AbCdE" say a Say translate(a, A2ZLower, A2ZUpper) Say translate(a, A2ZUpper, A2ZLower)...

Go Back   Application Development Forum > Programming Languages > REXX

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 08-24-2008, 12:20 PM
Snotty Wafflelips
Guest
 
Default Reginald: How to make a string lower case?

Quercus Rexx has both an upper() function and a lower() function built
into the language. Reginald does not seem to have either.

It does have the UPPER instruction, but no LOWER instruction.

Is there a better way to convert a string to lowercase than using
translate()?

A2ZUpper = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
A2ZLower = 'abcdefghijklmnopqrstuvwxyz'

a="AbCdE"
say a
Say translate(a, A2ZLower, A2ZUpper)
Say translate(a, A2ZUpper, A2ZLower)

Reply With Quote
  #2  
Old 08-26-2008, 05:16 AM
Bruce M. Axtens
Guest
 
Default Re: Reginald: How to make a string lower case?

On Sun, 24 Aug 2008 09:20:26 -0700, Snotty Wafflelips wrote:

> Is there a better way to convert a string to lowercase than using
> translate()?


Not being a Rexx junkie, I can't say for absolute sure, but all reading
I've done in the last 20 minutes suggests TRANSLATE. I did try to get
CHANGESTR to work but without much success.

Kind regards,
Bruce.

-- Posted on news://freenews.netfront.net - Complaints to news@netfront.net --
Reply With Quote
  #3  
Old 08-26-2008, 08:34 AM
Gary Scott
Guest
 
Default Re: Reginald: How to make a string lower case?

Snotty Wafflelips wrote:
> Quercus Rexx has both an upper() function and a lower() function built
> into the language. Reginald does not seem to have either.
>
> It does have the UPPER instruction, but no LOWER instruction.


I guess I was thinking of quercus/mansfield rexx (upper()). the UPPER
in standard rexx was part of the PARSE statement (PARSE UPPER), just a
shorthand version of it. That does seem like a deficiency, but is
common in many languages. It's usually easy enough to roll your own
though. Standards committees always seem to get their panties in a wad
over such translation issues (what code page to assume, what character
sets are supported, etc.) rather than just trying to stick to basics.

>
> Is there a better way to convert a string to lowercase than using
> translate()?
>
> A2ZUpper = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
> A2ZLower = 'abcdefghijklmnopqrstuvwxyz'
>
> a="AbCdE"
> say a
> Say translate(a, A2ZLower, A2ZUpper)
> Say translate(a, A2ZUpper, A2ZLower)
>



--

Gary Scott
mailto:garylscott@sbcglobal dot net

Fortran Library: http://www.fortranlib.com

Support the Original G95 Project: http://www.g95.org
-OR-
Support the GNU GFortran Project: http://gcc.gnu.org/fortran/index.html

If you want to do the impossible, don't hire an expert because he knows
it can't be done.

-- Henry Ford
Reply With Quote
  #4  
Old 08-26-2008, 02:08 PM
Steve Swift
Guest
 
Default Re: Reginald: How to make a string lower case?

Gary Scott wrote:
> I guess I was thinking of quercus/mansfield rexx (upper()). the UPPER
> in standard rexx was part of the PARSE statement (PARSE UPPER), just a
> shorthand version of it.


All the REXX's that I use also have PARSE LOWER, but I don't use reginald.

In my subroutine library I have:

::Routine lower public
Parse lower arg string /* Because it's faster */
Return string

However, I suspect that the speed advantage of PARSE over builtin
functions has been eroded over the years.

--
Steve Swift
http://www.swiftys.org.uk/swifty.html
http://www.ringers.org.uk
Reply With Quote
  #5  
Old 08-26-2008, 03:48 PM
Snotty Wafflelips
Guest
 
Default Re: Reginald: How to make a string lower case?

On Tue, 26 Aug 2008 17:16:37 +0800, "Bruce M. Axtens"
<bruce.axtens@gmail.com> wrote:

>On Sun, 24 Aug 2008 09:20:26 -0700, Snotty Wafflelips wrote:
>
>> Is there a better way to convert a string to lowercase than using
>> translate()?

>
>Not being a Rexx junkie, I can't say for absolute sure, but all reading
>I've done in the last 20 minutes suggests TRANSLATE. I did try to get
>CHANGESTR to work but without much success.


Doing it with changestr would require looping through each of the 26
letters.
Reply With Quote
  #6  
Old 08-26-2008, 03:52 PM
Snotty Wafflelips
Guest
 
Default Re: Reginald: How to make a string lower case?

On Tue, 26 Aug 2008 19:08:41 +0100, Steve Swift
<Steve.J.Swift@gmail.com> wrote:

>Gary Scott wrote:
>> I guess I was thinking of quercus/mansfield rexx (upper()). the UPPER
>> in standard rexx was part of the PARSE statement (PARSE UPPER), just a
>> shorthand version of it.

>
>All the REXX's that I use also have PARSE LOWER, but I don't use reginald.


PARSE LOWER ought to be included if PARSE UPPER is.
Reply With Quote
  #7  
Old 08-26-2008, 06:18 PM
GaryScott
Guest
 
Default Re: Reginald: How to make a string lower case?

On Aug 26, 1:08*pm, Steve Swift <Steve.J.Sw...@gmail.com> wrote:
> Gary Scott wrote:
> > I guess I was thinking of quercus/mansfield rexx (upper()). *the UPPER
> > in standard rexx was part of the PARSE statement (PARSE UPPER), just a
> > shorthand version of it.

>
> All the REXX's that I use also have PARSE LOWER, but I don't use reginald..


I didn't have time to check further but I only found PARSE UPPER in my
REXX book by Mike C. I was thinking it should be there, but if so,
its been a very long time since I used it.

>
> In my subroutine library I have:
>
> ::Routine lower public
> Parse lower arg string */* Because it's faster **/
> Return string
>
> However, I suspect that the speed advantage of PARSE over builtin
> functions has been eroded over the years.
>
> --
> Steve Swifthttp://www.swiftys.org.uk/swifty.htmlhttp://www.ringers.org.uk


Reply With Quote
  #8  
Old 08-26-2008, 07:05 PM
Snotty Wafflelips
Guest
 
Default Re: Reginald: How to make a string lower case?

On Tue, 26 Aug 2008 15:18:18 -0700 (PDT), GaryScott
<garylscott@sbcglobal.net> wrote:

>On Aug 26, 1:08*pm, Steve Swift <Steve.J.Sw...@gmail.com> wrote:
>> Gary Scott wrote:
>> > I guess I was thinking of quercus/mansfield rexx (upper()). *the UPPER
>> > in standard rexx was part of the PARSE statement (PARSE UPPER), just a
>> > shorthand version of it.

>>
>> All the REXX's that I use also have PARSE LOWER, but I don't use reginald.

>
>I didn't have time to check further but I only found PARSE UPPER in my
>REXX book by Mike C. I was thinking it should be there, but if so,
>its been a very long time since I used it.


That's correct. The original VM/370 has PARSE UPPER, but not PARSE
LOWER. In retrospect, it should have had both or neither.
Reply With Quote
  #9  
Old 08-27-2008, 10:28 AM
Steve Swift
Guest
 
Default Re: Reginald: How to make a string lower case?

Snotty Wafflelips wrote:
> That's correct. The original VM/370 has PARSE UPPER, but not PARSE
> LOWER. In retrospect, it should have had both or neither.


Having just PARSE UPPER was reasonable around the time REXX was
developed. My 3277 screen could not display lower case letters, yet the
keyboard could enter them. Lower case letters were rare, and often
caused data-dependant bugs, so PARSE UPPER could be used to eliminate
this possibility. Userids and passwords were case insensitive, and the
easiest way to ensure this was to fold everything to upper case during
input.
It was several years before lower/mixed case really started to take hold.

I'll admit that PARSE LOWER was well overdue by the time it arrived, but
required a new REXX (IBM Object Rexx) as traditional REXX had
"solidified" by then.

I only recently discovered PARSE CASELESS, and am using it to eliminate
quite a few redundant lines of code now.

--
Steve Swift
http://www.swiftys.org.uk/swifty.html
http://www.ringers.org.uk
Reply With Quote
  #10  
Old 08-27-2008, 10:32 AM
Steve Swift
Guest
 
Default Re: Reginald: How to make a string lower case?

Snotty Wafflelips wrote:

> Doing it with changestr would require looping through each of the 26
> letters.


And if we want to go off into endless debate, we can consider letters
such as Ü. Even us dyed-in-the-wool British come across accented
characters from time to time, and they defeat the simple forms of
TRANSLATE().

--
Steve Swift
http://www.swiftys.org.uk/swifty.html
http://www.ringers.org.uk
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 08:32 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.