@RTrim[] inconsistence

#1
/me again.
Using both TCC17 and TCC/LE:
Code:
echo _%@rtrim[" "," word " ]_
_" word_
From the doc: String1 must be enclosed in double quotes if it contains any spaces, tabs, or commas.
I expect, that if String1 is enclosed with double quotes: quotes are not removed, they are required to mark the space.

Escaping space (instead of quoting) doesn't work:
Code:
echo _%@rtrim[^s," word " ]_
_" word " _
 

samintz

Scott Mintz
May 20, 2008
1,313
11
Solon, OH, USA
#2
I'm not sure what you are asking for. If you don't want the quotes in the string being trimmed, then remove them.
Code:
echo _%@rtrim[" ", word ]_
_ word_

echo _%@rtrim[" ",%@unquote[" word "] ]_
_ word_
However, there is an inconsistency with "blah<space>"<space>. @RTRIM removes the trailing quote, combines the spaces and then removes them. I'm not sure what the "correct" behavior is in that case.
 
May 29, 2008
533
3
Groton, CT
#4
It looks to me like the quote marks have no special meaning, that is, they are part of the string, rather than enclosing the string. I found this works:
Code:
k> echo _%@rtrim[` `, word ]_
_ word_
 
#5
To be sure:
I expected, to get:
Code:
echo _%@rtrim[" "," word " ]_
_" word "_
with the most right space removed, and double quotes preserved (not removed).

@dcantor - thanks, it works in that manner:
Code:
echo _%@rtrim[` `," word " ]_
_" word "_
[/cde]
 

samintz

Scott Mintz
May 20, 2008
1,313
11
Solon, OH, USA
#6
I just relooked at your initial example. You used ^s which I'm not exactly sure what that is. Had you used an actual escaped space '^ ' it would have done the same thing as the back ticks.
Code:
echo _%@rtrim[^ ," word " ]_
_" word "_
 
#9
What I think it's doing (wrongly) is treating the closing quote of the first parameter as one the characters to be trimmed.
Code:
v:\> echo _%@rtrim[" d"," word "]_
_" wor_

v:\> echo _%@rtrim[" d"," word "d]_
_" wor_