필터 지우기
필터 지우기

How do I determine if a word has a certain character in it?

조회 수: 4 (최근 30일)
Rebecca Hussey
Rebecca Hussey 2015년 11월 4일
댓글: Image Analyst 2015년 11월 5일
How do I determine if a word has a certain character in it?
For example if I have a word ?????? and want to know if the letter c is in it?

채택된 답변

TastyPastry
TastyPastry 2015년 11월 4일
편집: TastyPastry 2015년 11월 4일
If you only want to know whether or not the letter is in the word...
hasLetter = any(myWord == 'c');

추가 답변 (1개)

Image Analyst
Image Analyst 2015년 11월 4일
How about strfind()
index = strfind(string, 'c');

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by