matlab涓璼trcmp鍑芥暟鎬庝箞浣跨敤
strcmp鍑芥暟鐢ㄤ簬姣旇緝涓や釜瀛楃涓叉槸鍚︾浉绛夈€傚叾鍩烘湰璇硶濡備笅锛?/p>
result = strcmp(str1, str2)
鍏朵腑锛?code>str1鍜?code>str2鏄姣旇緝鐨勪袱涓瓧绗︿覆锛?code>result鏄竴涓€昏緫鍊硷紝濡傛灉涓や釜瀛楃涓茬浉绛夛紝鍒?code>result涓?锛屽惁鍒欎负0銆?/p>
渚嬪锛?/p>
str1 = 'hello';
str2 = 'world';
result = strcmp(str1, str2);
disp(result);
杩愯浠ヤ笂浠g爜锛屽皢杈撳嚭缁撴灉涓?锛屽洜涓?code>str1鍜?code>str2涓嶇浉绛夈€?/p>
相关问答