Effacer les filtres
Effacer les filtres

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

4 vues (au cours des 30 derniers jours)
Rebecca Hussey
Rebecca Hussey le 4 Nov 2015
Commenté : Image Analyst le 5 Nov 2015
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?

Réponse acceptée

TastyPastry
TastyPastry le 4 Nov 2015
Modifié(e) : TastyPastry le 4 Nov 2015
If you only want to know whether or not the letter is in the word...
hasLetter = any(myWord == 'c');
  1 commentaire
Image Analyst
Image Analyst le 5 Nov 2015
I gave that cell array answer in the duplicate question.

Connectez-vous pour commenter.

Plus de réponses (1)

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

Catégories

En savoir plus sur Characters and Strings dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by