zsh-users
 help / color / mirror / code / Atom feed
From: Mikael Magnusson <mikachu@gmail.com>
To: zsh-users@zsh.org
Subject: Re: How to capitalize last character of a string?
Date: Tue, 26 Oct 2010 15:08:21 +0200	[thread overview]
Message-ID: <AANLkTi=e8EJuufz9-VFT+NOT=0MjcWu-BQYGYiLWTw+z@mail.gmail.com> (raw)
In-Reply-To: <AANLkTik=7VYJP_BB-KL+mLDZ0PQe652+82cz1w5JFEAq@mail.gmail.com>

On 26 October 2010 13:56, András Nemes <andras.nemes@gmail.com> wrote:
> nearly there.
>
> print "$TEST[1,-2]${(C)TEST[-1]}"
>
> On Tue, Oct 26, 2010 at 10:42 PM,  <nix@myproxylists.com> wrote:
>> Hi, as the subject says, any guidance?
>>
>> TEST="word"
>>
>> print "${(C)TEST[1]}$TEST[2,-1]"
>>
>> Capitalizes the first character but somehow I could not come up with
>> solution other way.

And if for some reason you want to capitalize the last letter of every
word in a sentence (really, when don't you want to do that?),

% TEST="this is a sentence"
% echo ${(j::)${(@Oa)${(s::)${(Cj::)${(@Oa)${(s::)TEST}}}}}}
thiS iS A sentencE

-- 
Mikael Magnusson


  reply	other threads:[~2010-10-26 13:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-26 11:42 nix
2010-10-26 11:56 ` András Nemes
2010-10-26 13:08   ` Mikael Magnusson [this message]
2010-10-26 20:27 nix
2010-10-26 20:49 ` Eric De Mund
2010-10-26 21:42   ` nix
2010-10-26 21:56     ` Linus Arver

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AANLkTi=e8EJuufz9-VFT+NOT=0MjcWu-BQYGYiLWTw+z@mail.gmail.com' \
    --to=mikachu@gmail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).