ooRexx version:
$rexx -V
Open Object Rexx Version 4.2.0
Build date: Dec 29 2013
Addressing Mode: 64
Operating System:
$cat /etc/os-release
NAME=openSUSE
VERSION="13.1 (Bottle)"
VERSION_ID="13.1"
PRETTY_NAME="openSUSE 13.1 (Bottle) (x86_64)"
ID=opensuse
$uname -a
Linux pinto 3.11.10-7-desktop #1 SMP PREEMPT Mon Feb 3 09:41:24 UTC 2014 (750023e) x86_64 x86_64 x86_64 GNU/Linux
Issue:
The left, center|centre and right string methods do not perform as specified in the ooRexx Language Reference. They do not truncate the input string according to the length specified. In contrast, the equivalent BIFs work as expected.
A program that illustrates the issues is attached.
Anonymous
The functions are working exactly as they should be. The difference is caused by an error in your program involving operator precedence. The two lines
say '(left method): ' fullName' ' ~ left(20, '.') phoneNumber
and
say '(left function): ' left(fullName' ', 20,'.') phoneNumber
Are NOT equivalent (I recommend you runs these using Trace I so you can see how they evaluate differently.
The ~ operator has a higher precedence than concatenate, so the method version is operating on the string ' ' and that result is concatenated to the contents of the variable fullname. To make this equivalent to the bif version, you need to code it like this:
say '(left method): ' (fullName' ') ~ left(20, '.') phoneNumber
So that the left method gets applied to the result of concatenating fullname with a blank.
On Sunday 01 June 2014 05:12:48 Rick McGuire wrote:
--
"Disobedience is the true foundation of liberty. The obedient must be
slaves." --Henry David Thoreau