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/substr.tm.html
Hardcopy (PDF): A4 | Letter
AHELP for CIAO 3.4 substr Context: slangrtl

Synopsis

Extract a substring from a string

Syntax

String_Type substr (String_Type s, Integer_Type n, Integer_Type len)

Description

The substr function returns a substring with length len of the string s beginning at position n. If len is -1, the entire length of the string s will be used for len. The first character of s is given by n equal to 1.

Example

     substr ("To be or not to be", 7, 5);

returns "or no"

In many cases it is more convenient to use array indexing rather than the substr function. In fact, substr(s,i+1,strlen(s)) is equivalent to s[[i:]].

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.