IF Statements - case sensitive
6 次查看(过去 30 天)
显示 更早的评论
I am writing an IF statement. The user is prompt to enter the word "play" to begin, how do I write it so it is not case sensitive. For example they could enter "Play" or pLay" or PLAy" and it would accept the word
0 个评论
回答(1 个)
Chad Greene
2014-2-28
Try the strcmpi function.
1 个评论
Chad Greene
2014-2-28
For example:
user_input = 'plAy';
if strcmpi(user_input,'play')
disp('the user has input the word play')
end
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Audio and Video Data 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!