Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

@RTrim[] inconsistence

Jun
98
0
/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 " _
 
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.
 
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.
 
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_
 
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]
 
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 "_
 
^s is the escape sequence for a space (as ^n is for a newline, et cetera).
 
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_
 
Back
Top