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 MERGE

Name:
    STRING MERGE
Type:
    Let Subcommand
Purpose:
    Insert the contents of one string into another string at a specified position.
Description:
    This command is used to insert the contents of one string into an arbitrary position of another string. For example, if the original string is

      FILE.DAT

    and the insertion string is

      99

    and the merge position is given as 5, then the resulting merged string would be

      FILE99.DAT

    Note that if the the merge position is 5, then the insertion string starts at position 5 (i.e., the position parameter is the before position rather than the after position).

    The STRING REPLACE command performs a similar function. However, the original string is not shifted. In the above example, the resulting string from the STRING REPLACE command would be

      FILE99AT

    The STRING EDIT command can be used to perform more general edits of a string.

Syntax:
    LET <sout> = STRING MERGE <sorg> <snew> <nstart>
    where <sout> is the name of the resulting string;
                <sorg> is the name of the original string;
                <snew> is the name of the insertion string;
    and <nstart> is the merge position.
Examples:
    LET SOUT = STRING MERGE S1 SNEW NSTART
Note:
    The name of the new string can be the same as the original string. For example,

      LET FNAME = STRING MERGE FNAME SNEW NSTART
Note:
    Both strings on the right hand side of the equal sign must be previously existing strings. That is, expressions are not allowed. For example, instead of

      LET FNAME = STRING MERGE FNAME ".dat" NSTART

    you need to do

      LET STRING SNEW = .dat
      LET FNAME = STRING MERGE FNAME SNEW NSTART

    The starting position can be either a parameter or a numeric value. However, it cannot be a numeric expression. So

      LET FNAME = STRING MERGE FNAME SNEW NSTART
      LET FNAME = STRING MERGE FNAME SNEW 5

    are both allowed but

      LET FNAME = STRING MERGE FNAME SNEW NLEN/2

    is not allowed. You would need to enter this as

      LET NSTART = NLEN/2
      LET FNAME = STRING MERGE FNAME SNEW NSTART
Note:
    The total number of characters that DATAPLOT can use for storing functions and strings is set when DATAPLOT is built. The current default (11/2008) is 50,000 characters. Previous versions may set this limit at 1,000 or 10,000 characters. This limit applies to the combined number of characters for all functions and strings.
Default:
    None
Synonyms:
    None
Related Commands: Applications:
    Data Management
Implementation Date:
    11/2008
Program 1:
     
    LET STRING S1 = file.dat
    LET STRING S2 = 23
    LET NPOS = 5
    LET SOUT = STRING MERGE S1 S2 NPOS
        
    The resulting string SOUT will contain

      file23.txt
Program 2:
     
    .  Assume we have variables X and Y in the files "file1.dat" to
    .  "file10.dat" and we want to plot each of these in turn.
    .
    LET STRING SOLD = file.dat
    LET NPOS = 5
    TITLE CASE ASIS
    LOOP FOR K = 1 1 10
        LET STRING S2 = ^K
        LET FNAME = STRING MERGE SOLD S2 NPOS
        READ ^FNAME  Y X
        TITLE Data from File ^SOUT
        PLOT Y X
        DELETE Y X
    END OF LOOP
        

Date created: 12/4/2008
Last updated: 12/4/2008
Please email comments on this WWW page to alan.heckert@nist.gov.