Upper first letter of a text input

9 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Develop 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