| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| 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) |
|
#2
| |||
| |||
| 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 -- |
|
#3
| |||
| |||
| 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 |
|
#4
| |||
| |||
| 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 |
|
#5
| |||
| |||
| 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. |
|
#6
| |||
| |||
| 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. |
|
#7
| |||
| |||
| 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 |
|
#8
| |||
| |||
| 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. |
|
#9
| |||
| |||
| 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 |
|
#10
| |||
| |||
| 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 |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.