zsh-users
 help / color / mirror / code / Atom feed
From: Linus Arver <linusarver@gmail.com>
To: nix@myproxylists.com
Cc: zsh-users@zsh.org
Subject: Re: How to capitalize last character of a string?
Date: Tue, 26 Oct 2010 14:56:28 -0700	[thread overview]
Message-ID: <AANLkTi=7ETdvHW--SD12Zp7cj8XuJy_p0w17_H90SJdM@mail.gmail.com> (raw)
In-Reply-To: <425111e110945b68fb95a6176414d7da.squirrel@gameframe.net>

On Tue, Oct 26, 2010 at 2:42 PM,  <nix@myproxylists.com> wrote:
> Thanks. Sorry for duplicate question (i sent earlier this same question
> and some other gave a solution). It works yes.
>
> I am really having trouble with these modifiers. Last question: How to
> apply both macros (Capitalize the first and the last letter) ?
>
> [CapitaL]
>
> So the result would be: WorD

I'm pretty new to brace expansion myself, but by looking at your code
I figured it out:

TEST=word
print ${(C)TEST[1]}$TEST[2,-2]${(C)TEST[-1]}

output: WorD

-Linus


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

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
  -- strict thread matches above, loose matches on Subject: below --
2010-10-26 11:42 nix
2010-10-26 11:56 ` András Nemes
2010-10-26 13:08   ` Mikael Magnusson

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=7ETdvHW--SD12Zp7cj8XuJy_p0w17_H90SJdM@mail.gmail.com' \
    --to=linusarver@gmail.com \
    --cc=nix@myproxylists.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).