strncmpi
Compares first n characters of strings (case sensitive).
📝Syntax
res = strncmpi(s1, s2, n)
📥Input Arguments
Parameter Description
s1 a string, string array or cell of strings.
s2 a string, string array or cell of strings.
n an integer value: numbers of characters to compare.
📤Output Arguments
Parameter Description
res a logical: true if the two are identical and false otherwise.
📄Description
strncmpi compares the first n characters of two strings (case insensitive).
💡Examples
strncmpi('Nelson', 'nelSon', 3)
strncmpi('Nelson', 'Nelson', 3)

A = {'Nel', 'son'; 'Toolboxes', 'Modules'}
B = {'Handle', 'Struct'; 'Toolboxes', 'Modules'}
C = {'C', 'Contents'; 'Nel', 'son'}
strncmpi(A, B, 2)
strncmpi(A, C, 2)
strncmpi(C, 'C', 4)
🔗See Also
strncmpstrcmp
🕔Version History
Version Description
1.0.0 initial version
Edit this page on GitHub