![]() |
STRING MERGEName:
and the insertion string is
and the merge position is given as 5, then the resulting merged string would be
Note that if the the merge position is 5, then the insertion string starts at position 5 (i.e., the position parameter is the before position rather than the after position). The STRING REPLACE command performs a similar function. However, the original string is not shifted. In the above example, the resulting string from the STRING REPLACE command would be
The STRING EDIT command can be used to perform more general edits of a string.
where <sout> is the name of the resulting string; <sorg> is the name of the original string; <snew> is the name of the insertion string; and <nstart> is the merge position.
you need to do
LET FNAME = STRING MERGE FNAME SNEW NSTART The starting position can be either a parameter or a numeric value. However, it cannot be a numeric expression. So
LET FNAME = STRING MERGE FNAME SNEW 5 are both allowed but
is not allowed. You would need to enter this as
LET FNAME = STRING MERGE FNAME SNEW NSTART
LET STRING S1 = file.dat LET STRING S2 = 23 LET NPOS = 5 LET SOUT = STRING MERGE S1 S2 NPOSThe resulting string SOUT will contain
. 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 = file.dat LET NPOS = 5 TITLE CASE ASIS LOOP FOR K = 1 1 10 LET STRING S2 = ^K LET FNAME = STRING MERGE SOLD S2 NPOS READ ^FNAME Y X TITLE Data from File ^SOUT PLOT Y X DELETE Y X END OF LOOP
Date created: 12/4/2008 |