Displaying 2 results from an estimated 2 matches for "1var".
Did you mean:
1va
2005 Mar 22
1
sub('^','var',1:3) produces unexpected results
Hi,
According to help(sub), the ^ should match the zero-length string at the
beginning of a string:
sub('^','var',1:3) # "1" "2" "3"
sub('$','var',1:3) # "1var" "2var" "3var"
# This generates what I expected from the first case:
sub('^.','var',11:13) # "var1" "var2" "var3"
Dave
--
Dr. David Forrest
drf at vims.edu (804)684-7900w
drf5n at maplep...
2005 Mar 23
2
sub('^', .....) bugs (PR#7742)
...) writes:
David> According to help(sub), the ^ should match the
David> zero-length string at the beginning of a string:
yes, indeed.
David> sub('^','var',1:3) # "1" "2" "3"
David> sub('$','var',1:3) # "1var" "2var" "3var"
David> # This generates what I expected from the first case:
David> sub('^.','var',11:13) # "var1" "var2" "var3"
there are even more fishy things here:
1) In your cases, the integer 'x' a...