SED navigation bar go to SED home page go to Dataplot home page go to NIST home page SED Home Page SED Staff SED Projects SED Products and Publications Search SED Pages
Dataplot Vol 2 Vol 1

STRING INDEX

Name:
    STRING INDEX
    STRING RIGHT INDEX
Type:
    Let Subcommand
Purpose:
    Return the start and stop position of a substring within a string.
Syntax 1:
    LET <nstart> <nstop> = STRING INDEX <sorg> <smatch>
    where <nstart> is a parameter containing the returned start position;
                <nstop> is a parameter containing the returned stop position;
                <sorg> is the original string;
                and     <smatch> is the substring to be matched within <sorg>;

    This syntax searches <sorg> from left to right.

Syntax 2:
    LET <nstart> <nstop> = STRING RIGHT INDEX <sorg> <smatch>
    where <nstart> is a parameter containing the returned start position;
                <nstop> is a parameter containing the returned stop position;
                <sorg> is the original string;
                and     <smatch> is the substring to be matched within <sorg>;

    This syntax searches <sorg> from right to left.

Examples:
    LET NSTART NSTOP = STRING INDEX S1 S2
    LET NSTART NSTOP = STRING RIGHT INDEX SORG SMATCH
Note:
    Both of the strings on the right hand side of the equal sign must be previously defined strings. String expressions are not allowed. So

      LET NSTART NSTOP = STRING INDEX SORG ".dat"

    should be coded as

      LET STRING S2 = .dat
      LET NSTART NSTOP = STRING INDEX SORG S2
Default:
    None
Synonyms:
    STRING FIND is a synonym for STRING INDEX
    STRING RIGHT FIND is a synonym for STRING RIGHT INDEX
Related Commands: Applications:
    Data Management
Implementation Date:
    2008/11
    2018/10: Added STRING RIGHT INDEX
    2018/10: Added STRING FIND as a synonym for STRING INDEX
Program:
     
    LET STRING S1 = file23.dat
    LET STRING S2 = 23
    LET NSTART NSTOP = STRING INDEX S1 S2
        
    The resulting values of NSTART and NSTOP are 5 and 6, respectively.

Privacy Policy/Security Notice
Disclaimer | FOIA

NIST is an agency of the U.S. Commerce Department.

Date created: 12/04/2008
Last updated: 10/16/2018

Please email comments on this WWW page to alan.heckert@nist.gov.