strmid() [message #46925] |
Wed, 11 January 2006 06:09 |
Liberum
Messages: 48 Registered: September 2005
|
Member |
|
|
Hi everyone,
Can someone check this out and explain it to me becuase I don't get it
at all:
**********************************************
a = "some_ordinaryfile.h5"
IDL> print, strmid(a,0,2,/reverse_offset)
5
IDL> print, strmid(a,0,3,/reverse_offset)
5
IDL> print, strmid(a,0,1)
s
IDL> print, strmid(a,0,2)
so
IDL> print, strmid(a,0,3)
som
IDL>
Now according to the instruction book the keyword: REVERSE_OFFSET
forces IDL to start counting from the end of the file so it should work
like this:
print, strmid(a,0,2,/reverse_offset)
h5
print, strmid(a,0,3,/reverse_offset)
.h5
but it doesn't. why ???
*******************************
At first I played around untilI found something that worked:
IDL> print, strmid(a,2,4,/reverse_offset)
.h5
which implies that the string is 2 characters longer but then when I
did this:
IDL> print, strmid(a,0,1,/reverse_offset)
5
This proves that the string is not longer. What is the logic behind
this?
Anyone, anyone!!
Sincerely,
Sheldon
IDL> print, strmid(a,2,4,/reverse_offset)
.h5
|
|
|