zsh-users
 help / color / mirror / code / Atom feed
From: nix@myproxylists.com
To: zsh-users@zsh.org
Subject: Re: How to capitalize last character of a string?
Date: Wed, 27 Oct 2010 00:42:53 +0300	[thread overview]
Message-ID: <425111e110945b68fb95a6176414d7da.squirrel@gameframe.net> (raw)
In-Reply-To: <19655.16111.999209.381824@ixian.com>

> nix,
>
> nix@myproxylists.com writes:
> ] Subject: How to capitalize last character of a string?
> ] 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.
>
> I'm not familiar with the syntax, but inferred the following. It seems
> to work:
>
>     % TEST="word"
>     % print "$TEST[1,-2]${(C)TEST[-1]}"
>     worD
>     %
>
> Regards,
> Eric
> --
> Eric De Mund
> ead@ixian.com
>

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






  reply	other threads:[~2010-10-26 21:43 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 [this message]
2010-10-26 21:56     ` Linus Arver
  -- 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=425111e110945b68fb95a6176414d7da.squirrel@gameframe.net \
    --to=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).