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

Synopsis

Replace a character with another in a string.

Syntax

String_Type strsub (String_Type s, Integer_Type pos, Integer_Type ch)

Description

The strsub character may be used to substitute the character ch for the character at position pos of the string s. The resulting string is returned.

Example

    define replace_spaces_with_comma (s)
    {
      variable n;
      while (n = is_substr (s, " "), n) s = strsub (s, n, ',');
      return s;
    }

For uses such as this, the strtrans function is a better choice.

The first character in the string s is specified by pos equal to 1.

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.