[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Concatenate elements of string array
- Subject: Re: Concatenate elements of string array
- From: Ruhaltinger Norbert <norbertr(at)icg.tu-graz.ac.SIG>
- Date: Wed, 11 Aug 1999 14:56:42 +0200
- Newsgroups: comp.lang.idl-pvwave
- Organization: Graz University of Technology, Austria
- References: <7ondpt$mv$1@nnrp1.deja.com>
- Xref: news.doit.wisc.edu comp.lang.idl-pvwave:16068
kluegel@lanl.gov wrote:
>
> Does anyone out there have a clever idea on how to
> concatenate all elements of a one dimensional array
> of strings? Of course, explicit looping is the
> obvious way to do it, but approaches using array
> manipulation tend to be more efficient. Any
> array-based approaches out there?
>
> Thanks for any ideas.
>
string can be used like sprintf in C
You have to create the Format specification on the fly
IDL> string_array=['one ','string ','split ',$
'into ','many ','array elements']
IDL> help,string_array & print,string_array
STRING_ARRAY STRING = Array[6]
one string split into many array elements
IDL> one_string = string(string_array, $
format = '(' + string(n_elements(string_array)) + 'A)')
IDL> help,one_string & print,one_string
ONE_STRING STRING = 'one string split into many array elements'
one string split into many array elements
--
to reply, change the 'SIG' at the end of my adress to 'at' - thx!