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 EXPAND WHITESPACE

Name:
    STRING EXPAND WHITESPACE
Type:
    Let Subcommand
Purpose:
    Replace non-printing characters in a string with a single space character.
Description:
    When extracting strings from external sources, you may encounter non-printing characters. The STRING REMOVE WHITESPACE can be used to simply remove these characters from the string. Alternatively, the STRING EXPAND WHITESPACE can be used to convert non-printing characters to a single space character.

    The tab character is treated somewhat differently. Specifically, you can use the command

      SET TAB EXPAND <value>

    to specify how tab characters are handled. Specifically, if <value> is 0, then the tab character is retained in the string (no space is added). If <value> is a positive integer, the tab character will be replaced with <value> spaces.

    The non-printing characters are the ones with codes 0 to 31 and 127 in the ASCII collating sequence. Currently, Dataplot only checks for characters in the 0 - 127 range of the ASCII collating sequence.

Syntax:
    LET <sout> = STRING EXPAND WHITESPACE <sorg>
    where <sout> is the name of the resulting string;
    and      <sorg> is the name of the original string.
Examples:
    LET SOUT = STRING EXPAND WHITESPACE STIN
Note:
    The name of the new string can be the same as the original string. For example,

      LET STR = STRING EXPAND WHITESPACE STR

    In this case, STR will now contain the the string with all white space characters removed rather than the original string.

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, the following will result in an error message

      LET STOUT = STRING EXPAND WHITESPACE "a b c d"

    you need to do

      LET STRING SORG = a b c d
      LET SOUT = STRING EXPAND WHITESPACE SORG

    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 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:
    2019/02
Program:
     
    set tab expand 3
    read string tab.dat t
    let tout = string expand whitespace t
    print t tout
        
    The following output is generated
     FUNCTIONS--
    
         T       --Text with	several	tab	characters
         TOUT    --Text with   several   tab   characters
        

Privacy Policy/Security Notice
Disclaimer | FOIA

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

Date created: 02/27/2019
Last updated: 02/27/2019

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