strcmp strcmpi 比较字符串 matlab

来源:互联网 发布:男主是人工智能的小说 编辑:程序博客网 时间:2024/06/06 06:54

strcmp


Compare strings (case sensitive)
Syntax


TF = strcmp(string,string)
TF = strcmp(string,cellstr)
TF = strcmp(cellstr,cellstr)

Description


TF = strcmp(string,string) compares two strings for equality. The strings are considered to be equal if the size and content of each are the same. The function returns a scalar logical 1 for equality, or scalar logical 0 for inequality.

TF = strcmp(string,cellstr) compares a string with each element of a cell array of strings. The function returns a logical array the same size as the cellstr input in which logical 1 represents equality. The order of the input arguments is not important.

TF = strcmp(cellstr,cellstr) compares each element of one cell array of strings with the same element of the other. The function returns a logical array the same size as either cell array input.



strcmpi


Compare strings (case insensitive)
Syntax



TF = strcmpi(string,string)
TF = strcmpi(string,cellstr)
TF = strcmpi(cellstr,cellstr)

Description




TF = strcmpi(string,string) compares two strings for equality, ignoring any differences in letter case. The strings are considered to be equal if the size and content of each are the same. The function returns a scalar logical 1 for equality, or scalar logical 0 for inequality.

TF = strcmpi(string,cellstr) compares a string with each element of a cell array of strings, ignoring letter case. The function returns a logical array the same size as the cellstr input in which logical 1 represents equality. The order of the input arguments is not important.

TF = strcmpi(cellstr,cellstr) compares each element of one cell array of strings with the same element of the other, ignoring letter case. The function returns a logical array the same size as the input arrays.


原创粉丝点击