Filter löschen
Filter löschen

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

1 Ansicht (letzte 30 Tage)
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?

Akzeptierte Antwort

TastyPastry
TastyPastry am 4 Nov. 2015
Bearbeitet: TastyPastry am 4 Nov. 2015
If you only want to know whether or not the letter is in the word...
hasLetter = any(myWord == 'c');

Weitere Antworten (1)

Image Analyst
Image Analyst am 4 Nov. 2015
How about strfind()
index = strfind(string, 'c');

Kategorien

Mehr zu Characters and Strings finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by