next up previous contents
Next: Transforms/Decompositions Up: String Functions Previous: String Functions   Contents

Subsections

STRCMP String Compare Function

Usage

Compares two strings for equality. The general syntax for its use is

  p = strcmp(x,y)

where x and y are two strings. Returns true if x and y are the same size, and are equal (as strings). Otherwise, it returns false.

Example

The following piece of code compares two strings:

--> x1 = 'astring';
--> x2 = 'bstring';
--> x3 = 'astring';
--> strcmp(x1,x2)
ans = 
  <logical>  - size: [1 1]
 0  
--> strcmp(x1,x3)
ans = 
  <logical>  - size: [1 1]
 1



Samit K. Basu 2005-03-16