Re: STRMID question [message #26275] |
Mon, 20 August 2001 11:57 |
Pavel A. Romashkin
Messages: 531 Registered: November 2000
|
Senior Member |
|
|
IDL online help says:
"The form of First_Character and Length control how they are applied to
Expression. Either argument can be a scalar or an array:
* If a scalar value is supplied for First_Character and Length, then
those values are applied to all elements of Expression. The result has
the same structure and number of elements as Expression.
* If First_Character or Length is an array, the size of their first
dimension determines how many substrings are extracted from each element
of Expression. We call this the "stride". If both are arrays, they must
have the same stride. If First_Character or Length do not contain enough
elements to process Expression, STRMID automatically loops back to the
beginning as necessary. Excess values are ignored. If the stride is 1,
the result will have the same structure and number of elements as
Expression. If it is greater than 1, the result will have an additional
dimension, with the new first dimension having the same size as the stride."
BTW, are the delimiters exactly what you mean they should be?
IDL> delim1 = STRPOS( s, '_', /REVERSE_SEARCH ) + 1
IDL> print, delim1
1 1 1 1 1 1
1
1 1 1
IDL> print, delim2
1 2 3 4 5 6
7
8 9 10
Also, could the expected result be achieved using STRPLIT, /EXTRACT?
Cheers,
Pavel
|
|
|