Upper first letter of a text input

7 ビュー (過去 30 日間)
João Carvalho
João Carvalho 2017 年 12 月 6 日
回答済み: Stephen23 2017 年 12 月 6 日
Hello, I have a text input and I would like to save that text input with the first letter in uppercase and cut more than 30 letters, if necessary. What should I do? I have this:

採用された回答

Image Analyst
Image Analyst 2017 年 12 月 6 日
Try this:
lastIndex = min(30, length(new_user.name))
% Capitalize first character and lower case remaining characters.
new_user.name = [upper(new_user.name(1)), lower(new_user.name(2:lastIndex))];

その他の回答 (1 件)

Stephen23
Stephen23 2017 年 12 月 6 日
Simpler:
[upper(newuser.name(1)),newuser.name(2:min(30,end))]

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by