STRING EXPAND WHITESPACE
Replace non-printing characters in a string with a single space
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
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.
LET <sout> = STRING EXPAND WHITESPACE <sorg>
where <sout> is the name of the resulting string;
and <sorg> is the name of the
LET SOUT = STRING EXPAND WHITESPACE STIN
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.
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.
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.
set tab expand 3
read string tab.dat t
let tout = string expand whitespace t
print t tout
The following output is generated
T --Text with several tab characters
TOUT --Text with several tab characters
NIST is an agency of the U.S.
Date created: 02/27/2019
Last updated: 02/27/2019
Please email comments on this WWW page to