フィルターのクリア

identify lowercase letters, uppercase letters, numbers and spaces

9 ビュー (過去 30 日間)
Mireia Boneta Camí
Mireia Boneta Camí 2020 年 10 月 22 日
編集済み: Walter Roberson 2020 年 10 月 23 日
Hello everybody, I have this code and I would like that in the cases of the switch identify if the character of a given sentence is a lowercase letter, an uppercase or an space. Thank you very much!
sentence='Hello 22';
for ch=1:length(sentence)
switch sentence(ch)
case %if it is a lowercase letter
%blahblah
case %if it is an uppercase letter
%blahblah
case %if it is an space
%blahblah
end
end

採用された回答

Walter Roberson
Walter Roberson 2020 年 10 月 22 日
編集済み: Walter Roberson 2020 年 10 月 23 日
https://www.mathworks.com/help/matlab/ref/isstrprop.html is the only practical routine to use for this purpose. If you do not use it then chances become very high that your code will produce the wrong results for characters such as δ and ή and ř

その他の回答 (1 件)

John D'Errico
John D'Errico 2020 年 10 月 22 日
help ismember

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by