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 REPEAT

Name:
    STRING REPEAT
Type:
    Let Subcommand
Purpose:
    Create a string that repeats an input string a user specified number of times.
Syntax:
    LET <sout> = STRING REPEAT <sorg> <count>
    where <sout> is the name of the resulting string;
                <sorg> is the name of the original string;
    and     <count> is a number or parameter that specifies the number of
                times <sorg> will be repeated.
Examples:
    LET SOUT = STRING REPEAT S1 NWORD
    LET SOUT = STRING REPEAT S1 5
Note:
    The name of the new string can be the same as the original string. For example,

      LET S1 = STRING REPEAT S1 COUNT
Note:
    The string on the right hand side of the equal sign must be a previously existing string. That is, expressions are not allowed. For example, instead of

      LET SOUT = STRING REPEAT "a b c d" 2

    you need to do

      LET STRING SORG = a b c d
      LET SOUT = STRING REPEAT SORG 2

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

      LET SOUT = STRING REPEAT SORG 5
      LET SOUT = STRING REPEAT SORG COUNT

    are both allowed but

      LET SOUT = STRING REPEAT SORG COUNT/2

    is not allowed. You would need to enter this as

      LET COUNT2 = COUNT/2
      LET SOUT = STRING REPEAT SORG COUNT2

    The name on the left hand side of the equal sign may be a previously existing string. However, if it is a previously existing parameter, variable, or matrix name, an error will be reported and the requested string will not be created.

Note:
    The repeat factor should be in the range 1 to 255. If the repeat factor is outside this range, an error is reported and the requested string will not be created.

    The maximum length of the string to be repeated is 255 characters. If the the string is longer than this, an error is reported and the requested string will not be created.

Note:
    The total number of characters that Dataplot can use for storing functions and strings is set when DATAPLOT is built. The current default (08/2021) is 100,000 characters.
Default:
    None
Synonyms:
    None
Related Commands: Applications:
    Data Management
Implementation Date:
    2021/08
Program:
     
    let x = sequence 1 1 10
    let x2 = x**2
    let x3 = x**3
    let string s = -
    let sdash = string repeat s 30
    set write format 3F10.0
    write1 temp.out "         X      X**2      X**3"
    write1 temp.out "^sdash"
    write1 temp.out x x2 x3
        
    The file temp.out contains
     
             X      X**2      X**3
    ------------------------------
            1.        1.        1.
            2.        4.        8.
            3.        9.       27.
            4.       16.       64.
            5.       25.      125.
            6.       36.      216.
            7.       49.      343.
            8.       64.      512.
            9.       81.      729.
           10.      100.     1000.
        

Privacy Policy/Security Notice
Disclaimer | FOIA

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

Date created: 08/11/2021
Last updated: 08/11/2021

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