Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Capitalization tuning
- X-seq: zsh-users 13170
- From: henman@xxxxxxxxxxxxxxxx
- To: <zsh-users@xxxxxxxxxx>
- Subject: Capitalization tuning
- Date: Sun, 31 Aug 2008 09:37:24 +0900
- Cc:
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
In my audio filename normalization process, i.e., makeing the filenames be compliant to a convertion, I need to capitalize all words.
I used the parameter expansion flag (C) to capitalize filenames
In the manual it says
"C Capitalize the resulting words. 'Words' in this case refers to sequences of alphanumeric characters separated by non-alphanumerics, not to words that result from field splitting."
The problem with the current operation of the Capitalization function is that it capitalizes the first letter of conjunction tails as well.
For example:
$ CONJUNCT="I'll" && echo ${(C)CONJUNCT}
I'Ll
$CONJUNCT="They've" && echo ${(C)CONJUNCT}
They'Ve
and so on.
My question is can I make the capitalization function think "'" is a word character?
By say, chaning the system parameter WORDCHARS or by specifying some other flag or separater?
like:
W:sep: or
s:string: or
by changing IFS temporarily or
the w and s:string: subscript flags
etc.?
I noticed that there is no modifer for capitalization, only for l)owercase and u)pperase. So the parameter expansion flag must be used to capitalize or so I gather from reading the "April 2, 2008" dated manual.
I could do a brute force checking for all known conjunctions, but I'd prefer a more elegant procedure.
Thanks for any advice.
regards
d. henman
Messages sorted by:
Reverse Date,
Date,
Thread,
Author