Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: How to capitalize last character of a string?



nix,

nix@xxxxxxxxxxxxxxxx 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@xxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author