MATLAB FUNCTION FOR COMPARING TWO STRINGS

Scientific Bulletin of Naval Academy · 2017

Strings play an important role in the programming field.The programming languages offer to the programmers many functions to operate on strings.An important operation is the comparison of the strings.Matlab offers a set of functions for elementary operations with strings like: strcmp, strcmpi, strncmp and strncmpi.All these functions test whether two strings are identical or not.They do not offer information about the order in which the strings are compared relative to the ASCII codes order of the characters.In the C language there are defined the following functions: strcmp, stricmp, strncmp and strncimp that test the order of two strings according to the ASCII codes of the characters.In this paper, the author presents an implementation in Matlab of a function that produces that same comparison results as the strcmp function in the C language.

Read the paper · More papers on PaperTik