zsh-users
 help / color / mirror / code / Atom feed
* Capitalization tuning
@ 2008-08-31  0:37 henman
  2008-08-31  3:14 ` Mikael Magnusson
  2008-09-01  1:56 ` Aaron Davies
  0 siblings, 2 replies; 5+ messages in thread
From: henman @ 2008-08-31  0:37 UTC (permalink / raw)
  To: zsh-users


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-09-02  8:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-31  0:37 Capitalization tuning henman
2008-08-31  3:14 ` Mikael Magnusson
2008-09-01 23:36   ` d.henman
2008-09-02  8:43     ` Peter Stephenson
2008-09-01  1:56 ` Aaron Davies

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).