Capitalize only the first letter of a character

18 ビュー (過去 30 日間)
Ivan Mich
Ivan Mich 2021 年 1 月 25 日
編集済み: Ive J 2021 年 1 月 25 日
How to Capitalize only the first letter of a character ? upper function capitalize all the letters. I want only to make this change ONLY for the first letter.
Thank you in advance

採用された回答

David Hill
David Hill 2021 年 1 月 25 日
Likely a better way.
a='my name';
a(1)=upper(a(1));

その他の回答 (1 件)

Ive J
Ive J 2021 年 1 月 25 日
編集済み: Ive J 2021 年 1 月 25 日
str = "dogs are better than cats";
regexprep(str ,'(\<\w{1})', '${upper($1)}')
"Dogs Are Better Than Cats"

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by