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 REMOVE SPACES

Name:
    STRING REMOVE SPACES
Type:
    Let Subcommand
Purpose:
    Remove the spaces from a string.
Description:
    You can optionally remove all spaces, just the leading spaces, or just the trailing spaces from a string.
Syntax 1:
    LET <sout> = STRING REMOVE SPACES <sorg>
    where <sout> is the name of the resulting string;
    and     <sorg> is the name of the original string.

    This syntax removes all spaces from the string.

Syntax 2:
    LET <sout> = STRING REMOVE LEADING SPACES <sorg>
    where <sout> is the name of the resulting string;
    and     <sorg> is the name of the original string.

    This syntax removes only leading spaces from the string.

Syntax 3:
    LET <sout> = STRING REMOVE TRAILING SPACES <sorg>
    where <sout> is the name of the resulting string;
    and     <sorg> is the name of the original string.

    This syntax removes only trailing spaces from the string.

Examples:
    LET SOUT = STRING REMOVE SPACES STIN
    LET SOUT = STRING REMOVE LEADING SPACES STIN
    LET SOUT = STRING REMOVE TRAILING SPACES STIN
Note:
    The name of the new string can be the same as the original string. For example,

      LET FNAME = STRING REMOVE SPACES FNAME

    In this case, FNAME will now contain the string with all spaces 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 REMOVE SPACES "a b c d"

    you need to do

      LET STRING SORG = a b c d
      LET SOUT = STRING REMOVE SPACES 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:
    NUMBER OF WORDS = Return the number of words in a string.
    UPPER CASE = Convert a string to upper case.
    LOWER CASE = Convert a string to lower case.
    LET FUNCTION = Defines a function.
    LET STRING = Defines a string.
    READ STRING = Reads a string from a file.
    SUBTRING = Extract a substring from an existing string.
    STRING INDEX = Extract the start/stop positions of a substring within a string.
    STRING CONCATENATE = Concatenate one or more previously defined strings.
    STRING EDIT = Edit a string.
    STRING REPLACE = Insert the contents of one string into another string at a specified position.
    STRING MERGE = Insert a string into another string without overwrite.
    STRING LENGTH = Return the length of a string.
    CHARACTER = Convert numeric values to strings based on the ASCII collating sequence.
    ICHAR = Convert a string to numeric values based on the ASCII collating sequence.
    GROUP LABEL = Define the text for group labels.
Applications:
    Data Management
Implementation Date:
    2015/03
Program:
     
    let string stin = a b c d
    let stout = string remove spaces stin
    print stin stout
        
    The following output is generated
     FUNCTIONS--
    
         STIN    --a b c d
         STOUT   --abcd
        

Privacy Policy/Security Notice
Disclaimer | FOIA

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

Date created: 07/06/2015
Last updated: 07/06/2015

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