Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Capitalization tuning
- X-seq: zsh-users 13171
- From: "Mikael Magnusson" <mikachu@xxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: Capitalization tuning
- Date: Sun, 31 Aug 2008 05:14:03 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=r6mL6g08hA0bdnI/BoJkzOatCxUjZeMDZN5NnLonC1M=; b=EQa8QbfYKUwqERTzzSCqTd7MPZeetc/SS+cytXeXz2LdnqOqgTfPOeSsvgE0UXWEcX zdCZW3etxyVJtOLD+V57PWbSl2oxVPLXBL2WEIkGTmIxIWk/utnicUdX+ca8aeVPo+PN MFDU237bXklr/4XgGJeA8WGq24O7EuBxw8hcI=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=vlGCsXTLTSIAsNGTfLD7U/3CH7kZBCMYcbbz/tgqY7AMIPMhC4O2LdqCfNMw9mOSVP 8ISF8LYM3Sq4MWM/CatYZDrB5454hSvbl85UgMTMFO67zLlGm5eUddi5ZeIWf6PsmPTN OK/8wsiYnrTqPsCPqzzFFR2fKMgaufmcbskDU=
- In-reply-to: <20080831093724.444@blackhawk>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20080831093724.444@blackhawk>
2008/8/31 <henman@xxxxxxxxxxxxxxxx>:
>
> 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
This is possibly not the best, or even a good, way, but it seems to work:
${${(C)${CONJUNCT//\'/\'1}}//\'1/\'}
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author