@RTrim[] inconsistence

Jun 8, 2013
98
0
Warsaw, Poland
/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,332
12
Solon, OH, USA
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 20, 2008
9,348
62
Syracuse, NY, USA
It has nothing to do with the space after the closing quote.
Code:
v:\> echo _%@rtrim[" "," word "]_
_" word_
Removing one of a pair of quotes just seems wrong.
 
May 29, 2008
540
3
Groton, CT
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_
 
Jun 8, 2013
98
0
Warsaw, Poland
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,332
12
Solon, OH, USA
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 "_
 
May 20, 2008
9,348
62
Syracuse, NY, USA
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_