|
STRING EDITName:
The STRING EDIT command involves three string:
The STRING EDIT command searches the string SORG for the substring SOLD. If found, it replaces the SOLD text with the SNEW text. If no match is found, an error message is printed and the new string is not created.
where <sout> is the name of the resulting string; <sorg> is the name of the original string to be edited; <sold> is the name of the match string; and <snew> is the name of the replacement string. This syntax edits the first occurence of <sold> only.
where <sout> is the name of the resulting string; <sorg> is the name of the original string to be edited; <sold> is the name of the match string; and <snew> is the name of the replacement string. This syntax edits all occurence of <sold>.
LET STRING S2 = xx LET STRING S3 = 23 LET SOUT = STRING EDIT S1 S2 S3 LET SOUT = STRING GLOBAL EDIT S1 S2 S3
you need to do
LET STRING SNEW = .txt LET FNAME = STRING EDIT FNAME SOLD SNEW
Also, there is currently no support for wild cards or regular expressions. Note: The 2015/02 version of Dataplot added a global option (see Syntax 2 above).
LET SOUT = STRING EDIT STIN SOLD SNEW or
The use of "NULL()" is currently specific to this command.
2015/02: Support for STRING GLOBAL EDIT 2015/02: Support for "NULL()" for replacement string LET STRING S1 = file23.dat LET STRING S2 = dat LET STRING S3 = txt LET SOUT = STRING EDIT S1 S2 S3The resulting string SOUT will contain file23.txtProgram 2: . Assume we have variables X and Y in the files "file1.dat" to . "file10.dat" and we want to plot each of these in turn. . LET STRING SOLD = filexx.dat LET STRING S3 = xx TITLE CASE ASIS LOOP FOR K = 1 1 10 LET STRING S2 = ^K LET FNAME = STRING EDIT SOLD S3 S2 READ ^FNAME Y X TITLE Data from File ^SOUT PLOT Y X DELETE Y X END OF LOOP
Date created: 12/04/2008 |