About Chandra Archive Proposer Instruments & Calibration Newsletters Data Analysis HelpDesk Calibration Database NASA Archives & Centers Chandra Science Links

Skip the navigation links
Last modified: December 2006

URL: http://cxc.harvard.edu/ciao3.4/strcmp.tm.html
Hardcopy (PDF): A4 | Letter
AHELP for CIAO 3.4 strcmp Context: slangrtl

Synopsis

Compare two strings

Syntax

Interpret strcmp (String_Type a, String_Type b)

Description

The strcmp function may be used to perform a case-sensitive string comparison, in the lexicongraphic sense, on strings a and b. It returns 0 if the strings are identical, a negative integer if a is less than b, or a positive integer if a is greater than b.

Example

The strup function may be used to perform a case-insensitive string comparison:

    define case_insensitive_strcmp (a, b)
    {
      return strcmp (strup(a), strup(b));
    }

One may also use one of the binary comparison operators, e.g., a > b.

Hardcopy (PDF): A4 | Letter
Last modified: December 2006



The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory.
60 Garden Street, Cambridge, MA 02138 USA.    Email: cxcweb@head.cfa.harvard.edu
Smithsonian Institution, Copyright © 1998-2004. All rights reserved.