Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: (j.|.)



On Wed, Feb 1, 2023, at 5:47 PM, Ray Andrews wrote:
> I guess nobody's interested in these things but here's another 
> interesting one:
>
>
>      3 /aWorking/Zsh/Source/Wk 0 $ typeset -LZ zz='  Howdy  '; echo $zz; 
> dp zz
>        How
>      scalar-left-right_zeros zz='  Howdy  '
>
> Doc only says that '-LZ' will be specially handled but doesn't say how 
> right there.

Look at the documentation for "typeset -L".


> BTW we seem to use 'zeroes' sometimes in the docs 
> which is strictly speaking correct for 'zeroes in on the target' but 
> deprecated as the plural.

Debatable.  No reason to use both, though.


>   Ah!  It's not documented that I can see, but maybe the above is 
> accurately descriptive:
>
>
>      3 /aWorking/Zsh/Source/Wk 0 $ typeset -LZ zz='000Howdy000'; echo 
> $zz; dp zz
>      Howdy
>      scalar-left-right_zeros zz=000Howdy000
>
> ... so thereyago, it stripped zeros left and right :-)
>
> Doc says leading zeros will be removed but silent about trailing zeros.

That's because nothing is done to trailing zeros.

	% unset zz
	% typeset -LZ zz=000Howdy000
	% echo $zz
	Howdy000   
	% print -nr -- $zz | od -A n -t a
	           H   o   w   d   y   0   0   0  sp  sp  sp

I can't reproduce your results.  Try again in a clean shell, perhaps.


-- 
vq




Messages sorted by: Reverse Date, Date, Thread, Author