IF Statements - case sensitive

조회 수: 7 (최근 30일)
Allyson
Allyson 2014년 2월 28일
댓글: Chad Greene 2014년 2월 28일
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

답변 (1개)

Chad Greene
Chad Greene 2014년 2월 28일
Try the strcmpi function.
  댓글 수: 1
Chad Greene
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 CenterFile Exchange에서 Audio and Video Data에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by