Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
missing Parameter Expansion Flag?
- X-seq: zsh-users 12048
- From: Atom Smasher <atom@xxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: missing Parameter Expansion Flag?
- Date: Fri, 19 Oct 2007 12:53:21 +1300 (NZDT)
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- Openpgp: id=0xB88D52E4D9F57808; algo=1 (RSA); size=4096; url=http://atom.smasher.org/pgp.txt
let's say i set a string to print "xxxyyy" with the "xxx" in the default
color and the "yyy" in red:
foo="xxx${fg[red]}yyy"
which results in:
print ${foo}
xxxyyy
print ${(V)foo}
xxx^[[31myyy
in the first example above, the "yyy" is red.
now, let's say i want to count the characters in that string:
print ${#foo}
11
and of course, i can expand the meta-chars, and count the result of that:
print ${#${(V)foo}}
12
*but* i don't see how to count the string so that it just counts the
printing characters (xxxyyy). i want to count it so the count returns 6,
which is how many printable characters are in the string. intuitively, i
would think there should be a parameter expansion flag to do that, but i
can't find it. is there another (good*) way? should there be a flag for
that?
* good, above, means i don't want to filter out characters based on ascii
values.
--
...atom
________________________
http://atom.smasher.org/
762A 3B98 A3C3 96C9 C6B7 582A B88D 52E4 D9F5 7808
-------------------------------------------------
"Some folks look for answers
others look for fights,
some folks up in treetops
just looking for their kites"
-- Grateful Dead
Messages sorted by:
Reverse Date,
Date,
Thread,
Author