[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Odd string/index problem
- Subject: Re: Odd string/index problem
- From: Martin Schultz <martin.schultz(at)dkrz.de>
- Date: Thu, 14 Sep 2000 11:47:31 +0200
- Newsgroups: comp.lang.idl-pvwave
- Organization: Max-Planck-Institut fuer Meteorologie, Hamburg
- References: <39bfc95b.0@news.nwl.ac.uk>
- Xref: news.doit.wisc.edu comp.lang.idl-pvwave:21390
wmc@bas.ac.uk wrote:
>
> Can someone explain this to me:
>
> wmc> a='stoat'
> wmc> print,a([0]),'>'
> stoat
> >
> wmc> print,a(0),'>'
> stoat>
>
> This irritation surfaced when I tried to do
> i=where(strings eq somestring)
> print,strings(i)
>
> which needs to be
> i=i[0]
> print,strings(i)
>
> but why?
>
> -W.
>
To make sure things get written on one line you should either
concatenate the strings ('+') or use a format specifier.
print,a[[0]]+'>' gives you what you want as does
print,a[[0]],'>',format='(2A)' or print,a[[0]],format='(A,">")'. On
the other hand, even print,a[0],'>' will break the line if a is too
long. Example: a=string(bytarr(100)+64B) & print,a[0],'>' (whether
the number is 100 or something greater depends on your display window
width).
Cheers,
Martin
--
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
[[ Dr. Martin Schultz Max-Planck-Institut fuer Meteorologie [[
[[ Bundesstr. 55, 20146 Hamburg [[
[[ phone: +49 40 41173-308 [[
[[ fax: +49 40 41173-298 [[
[[ martin.schultz@dkrz.de [[
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[