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

8 ビュー (過去 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 月 5 日
I gave that cell array answer in the duplicate question.

サインインしてコメントする。

その他の回答 (1 件)

Image Analyst
Image Analyst 2015 年 11 月 4 日
How about strfind()
index = strfind(string, 'c');

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by