Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: How to capitalize last character of a string?
- X-seq: zsh-users 15501
- From: Linus Arver <linusarver@xxxxxxxxx>
- To: nix@xxxxxxxxxxxxxxxx
- Subject: Re: How to capitalize last character of a string?
- Date: Tue, 26 Oct 2010 14:56:28 -0700
- Cc: zsh-users@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=ukIa4NtEeKXX3hLvWh3TX86wUcq6/KEVd4Zt4aMWH1U=; b=RDV+ViJwktwC5VzDbsJc27ngCUCav23bB5FVMLVH8Ugskvq1YCCPEXa1kClRXH98yj jKfm3lJpfm+MuX0DmFSZNSJ/Y4hWBCd6LaZl5vIhdQfBu69cAtnVBx1LZOPk6sQELHdw gWWfOpsXX17dWEGG1dXr45JLJzjuSlvkEd4K8=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=q6HIfZVQoIYOXxJaTMTg2hdtxOPNcie8/UJCMzKNeW0hgg8APy00L2cg0pQUPPfaW5 ZZ+URP8D2nQrTfnMSaHK+AdkYzURTAmAo8Oea+mOWaADS8CxKke0fHOSMXtCWor3x/l6 bTwsRnJzK0g2NHUq8+YhhS0TmHUhoy9wqOI/M=
- In-reply-to: <425111e110945b68fb95a6176414d7da.squirrel@xxxxxxxxxxxxx>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <a695c10a88b7d75ca26ac49f3bd7c5c6.squirrel@xxxxxxxxxxxxx> <19655.16111.999209.381824@xxxxxxxxx> <425111e110945b68fb95a6176414d7da.squirrel@xxxxxxxxxxxxx>
On Tue, Oct 26, 2010 at 2:42 PM, <nix@xxxxxxxxxxxxxxxx> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author