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

NUMBER OF WORDS

Name:
    NUMBER OF WORDS
Type:
    Let Subcommand
Purpose:
    Return the number of words in a string.
Description:
    There may be times when it is useful to extract the individual words in a string. In order to automate this task, it is helpful to know the number of words in the string.

    Dataplot delineates words in a string by spaces. It will treat non-printing characters in the string as spaces. That is, any character in the string with an ASCII collating index less than or equal to 32 or greater than 127 will be treated as a space. In particular, tabs will be treated as spaces. However, hyphens and other special characters such as "&" will not be treated as word boundaries.

Syntax:
    LET <nword> = NUMBER OF WORDS <sorg>
    where <nword> is a parameter containing the returned number of words in the string; and <sorg> is the name of the string.
Examples:
    LET NWORD = NUMBER OF WORDS S1
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 NWORD = NUMBER OF WORDS "a b c d"

    you need to do

      LET STRING SORG = a b c d
      LET NWORD = NUMBER OF WORDS SORG

    The name on the left hand side of the equal sign may be a previously existing parameter. However, if it is a previously existing string/function, variable, or matrix name, an error will be reported and the requested parameter 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:
    10/2010
Program:
     
    let string s = funnel ramp cone square
    .
    feedback off
    print "String s = ^s"
    let nword = number of words s
    loop for k = 1 1 nword
        let s^k = string word s k
        print "String ^k = ^s^k"
    end of loop
    feedback on
        

Date created: 10/5/2010
Last updated: 10/5/2010
Please email comments on this WWW page to alan.heckert@nist.gov.