comparing two equal strings

1 visualizzazione (ultimi 30 giorni)
Bharat
Bharat il 27 Nov 2014
Modificato: Adam il 27 Nov 2014
Hello everyone. How do i return false when comparing two equal strings? i have two strings x = 'MIH06' and y= 'MIH06'. I want strcmp(x,y) to return false when compared . (I don't think strcmp does the job. Please suggest). Thanks.

Risposte (1)

Adam
Adam il 27 Nov 2014
Modificato: Adam il 27 Nov 2014
~strcmp( str1, str2 )
strcmp compares the two strings for equality. In your case the two strings are equal so you can't expect the function itself to return false so just negate its returned value.

Categorie

Scopri di più su Characters and Strings in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by