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

Re: Title Case a Textified String



On 11/03/2010 18.23, zzapper wrote:
I want to convert a textified string to a Title Case Phrase

eg
fred-goat-dog.jpg to Fred Goat Dog

% print ${${(Cs:-:):-fred-goat-dog.jpg}%.*}
Fred Goat Dog
Okay, yours has the most smileys, so I guess you win this round.
Thanks both of you and for completeness (and for anyone googling into this
thread)
a solution to textify Fred Goat Dog to fred-goat-dog.jpg?


% s='Fred Goat Dog'
% print ${(L)s:gs/ /-/}.jpg
fred-goat-dog.jpg

Or:

% print ${(L)s// /-}.jpg
fred-goat-dog.jpg


Regards
Dimitre



Regards
Dimitre



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