* Variable substitution Title Case @ 2011-02-23 11:39 zzapper 2011-02-23 12:04 ` Mikael Magnusson 0 siblings, 1 reply; 4+ messages in thread From: zzapper @ 2011-02-23 11:39 UTC (permalink / raw) To: zsh-users Hi url='www.some.com/some_string_here' want to extract and convert to' Some String Here' anchortext=${url##*/} # echo just the trailing directory anchortext=${anchortext//_/ } # substitute every _ with a space anchortext=${anchortext//-/ } # substitute every - with a space anchortext=${(L)anchortext} # lower case been messing around with anchortext=$anchortext:gs/// but dont know if uses regexp memory?? but how can I do titlecase? -- zzapper http://zzapper.co.uk/ Technical Tips ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Variable substitution Title Case 2011-02-23 11:39 Variable substitution Title Case zzapper @ 2011-02-23 12:04 ` Mikael Magnusson 2011-02-23 12:16 ` zzapper 2011-02-23 12:57 ` zzapper 0 siblings, 2 replies; 4+ messages in thread From: Mikael Magnusson @ 2011-02-23 12:04 UTC (permalink / raw) To: zzapper; +Cc: zsh-users On 23 February 2011 12:39, zzapper <david@tvis.co.uk> wrote: > Hi > > url='www.some.com/some_string_here' echo ${${(C)url//_/ }:t} -- Mikael Magnusson ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Variable substitution Title Case 2011-02-23 12:04 ` Mikael Magnusson @ 2011-02-23 12:16 ` zzapper 2011-02-23 12:57 ` zzapper 1 sibling, 0 replies; 4+ messages in thread From: zzapper @ 2011-02-23 12:16 UTC (permalink / raw) To: zsh-users Mikael Magnusson wrote in news:AANLkTikhiksgHA0vXgpq043_TmqaY4- HVciS7Qf=pQQU@mail.gmail.com: > On 23 February 2011 12:39, zzapper <david@tvis.co.uk> wrote: >> Hi >> >> url='www.some.com/some_string_here' > > echo ${${(C)url//_/ }:t} > > Thanks MM works a treat JWTDO -- zzapper http://zzapper.co.uk/ Technical Tips ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Variable substitution Title Case 2011-02-23 12:04 ` Mikael Magnusson 2011-02-23 12:16 ` zzapper @ 2011-02-23 12:57 ` zzapper 1 sibling, 0 replies; 4+ messages in thread From: zzapper @ 2011-02-23 12:57 UTC (permalink / raw) To: zsh-users Mikael Magnusson wrote in news:AANLkTikhiksgHA0vXgpq043_TmqaY4- HVciS7Qf=pQQU@mail.gmail.com: > url='www.some.com/some_string_here' > > echo ${${(C)url//_/ }:t} and the final script url='www.some.com/some_string-here' anchortext=${${(C)url//[_-]/ }:t} href="<a href='$url'>$anchortext</a>" -- zzapper http://zzapper.co.uk/ Technical Tips ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-02-23 12:58 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2011-02-23 11:39 Variable substitution Title Case zzapper 2011-02-23 12:04 ` Mikael Magnusson 2011-02-23 12:16 ` zzapper 2011-02-23 12:57 ` zzapper
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).