Re: Dumb problem with STRPOS [message #4731] |
Mon, 17 July 1995 00:00 |
larkum
Messages: 21 Registered: May 1993
|
Junior Member |
|
|
In article usi@ds2.acs.ucalgary.ca, steele@aragorn.phys.ucalgary.ca (Dave Steele) writes:
> Can someone explain the following behaviour to me?
>
> IDL> help,/st,!version ; Here's the situation.
> ** Structure !VERSION, 3 tags, length=24:
> ARCH STRING 'mipseb'
> OS STRING 'RISC/os'
> RELEASE STRING '3.1.0'
> IDL> test='c000.' ; define a string
> IDL> help,test ; check it is a string
> TEST STRING = 'c000.'
> IDL> print,strpos(test,'000') ; search for a substring
> 1
> IDL> print,strpos(test,'000.') ; and a slightly different one
> 1
> IDL> test='c0000.' ; add a '0'
> IDL> help,test
> TEST STRING = 'c0000.'
> IDL> print,strpos(test,'000') ; search again
> 1
> IDL> print,strpos(test,'000.') ; Why isn't this substring found???
> -1
>
> I checked the manual for this version and it says nothing that would
> explain this. BTW, it's nothing to do with octal constants.
>
> All suggestions gratefully received!
>
> Dave
Well, this bug goes back to the original code because it's in
the latest version of PV-Wave as well:
WAVE> info,/st,!version
** Structure !VERSION, 4 tags, 32 length:
ARCH STRING 'sparc'
OS STRING 'sunos'
RELEASE STRING '4.20'
PLATFORM STRING 'sun4'
WAVE> test='c000.'
WAVE> info, test
TEST STRING = 'c000.'
WAVE> print,strpos(test,'000')
1
WAVE> print,strpos(test,'000.')
1
WAVE> print,strpos(test,'000.')
1
WAVE> test='c0000.'
WAVE> info, test
TEST STRING = 'c0000.'
WAVE> print,strpos(test,'000')
1
WAVE> print,strpos(test,'000.')
-1
Sorry, I can't bring any joy for PV-Wave users either.
Matthew
____________________________________________________________ ______________
Matthew Larkum
Physiologisches Institut
Buehlplatz 5, CH-3012 Bern Switzerland
Ph. 41 31 631 8726 Fax. 41 31 631 4611
Internet: larkum@pyl.unibe.ch
matthewl@cortex.physiol.su.OZ.AU
|
|
|
|