Odd behavior with alias

Fluxxdog

Active member
Code:
> alias testing => ash print("%%:"+length("%%"));

String successfully aliased.
testing => ash print("%%:"+length("%%"))

> alias testing2 => ash print($string[%%]+":"+length($string[%%]));

String successfully aliased.
testing2 => ash print($string[%%]+":"+length($string[%%]))

>     testing2 four

four:4
Returned: void

> testing four

four :5
Returned: void

> testing2 four

four:4
Returned: void
I came across this and heavily doubt this is a mafia bug. It's also difficult to search the forums for this as searching for $string[ only searches for string. Does anyone have an explanation for the extra space?
 

xKiv

Active member
%% adds a space at the end unless contained in $string[], I think (or $string[] chops that space off).
 

Bale

Minion
$string[ ] assumes that anything bordered by whitespace does not include that whitespace so it is useful for removing the trailing space.
 
Last edited:
Top