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 15490
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: How to capitalize last character of a string?
- Date: Tue, 26 Oct 2010 15:08:21 +0200
- 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:content-type :content-transfer-encoding; bh=6yAMku4zqk6pb4rug0g2k0u/iFOjfWf0BZvQjTVYc+o=; b=N0yPIEAkJwAPGkJ7nzQuDR5vfn8yIhq0wq8l05HO23Z/hdc8h11aEdwPhCcQoONmWs j6Gmg+2p0GFbU7+X0KH9Xq01GTYumRkPhU5oId3DiS5yE04KiaSKskyLYFKIfodqQZmw OIAxy4zaQjDXOZniXsrOoERGLJ4DBhRgo0FO8=
- 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 :content-type:content-transfer-encoding; b=Fa74qbfO95vbQ2PCnhJL1aLoFM4SQYRCvLA8sdoaUqiCH5+fd6PCqVgKZoO/RL+K5/ 6YWP/44e2Vuqv73hKo53Ln5y3ZXUSUKPA6KXUPcoMG8+zytD5JgGC8riCwzcbhtHhmgY wLTJx4lfH+4QjK2a0KenoF9MAhuxcRZZQc5l0=
- In-reply-to: <AANLkTik=7VYJP_BB-KL+mLDZ0PQe652+82cz1w5JFEAq@xxxxxxxxxxxxxx>
- 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: <fe16f67c3c15aacfd6854935cee68e1f.squirrel@xxxxxxxxxxxxx> <AANLkTik=7VYJP_BB-KL+mLDZ0PQe652+82cz1w5JFEAq@xxxxxxxxxxxxxx>
On 26 October 2010 13:56, AndrÃs Nemes <andras.nemes@xxxxxxxxx> wrote:
> nearly there.
>
> print "$TEST[1,-2]${(C)TEST[-1]}"
>
> On Tue, Oct 26, 2010 at 10:42 PM, <nix@xxxxxxxxxxxxxxxx> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author