comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Concatenate elements of string array
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Concatenate elements of string array [message #16643 is a reply to message #16635] Tue, 10 August 1999 00:00 Go to previous messageGo to previous message
kluegel is currently offline  kluegel
Messages: 11
Registered: February 1999
Junior Member
In article <7oo5ds$c9c@post.gsfc.nasa.gov>,
fireman@mcst.gsfc.nasa.gov (Gwyn Fireman) wrote:

> 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> byte_array=byte(string_array)
> IDL> byte_array=reform(byte_array,n_elements(byte_array))
> IDL> byte_array=byte_array[where(byte_array ne 0)]
> IDL> one_string=string(byte_array)
> IDL> help,one_string & print,one_string
> ONE_STRING STRING = 'one string split into many array
elements'
> one string split into many array elements

Clever. Reminiscent of APL.

Playing with your approach, I see the BYTE(string_array) produces a 2D
array where one dimension is the number of characters in the longest
string of the original 1D array. So a nasty case would be an array of
strings where one string was very long and all the others were short.
This would make the intermediate 2D array very big.

Another limitation is that we must make a rule that no strings may
contain any nul characters.

Something tells me this is all the better that can be done with
array-based approaches. But just in case... Any other ideas out there?

-- Tom Kluegel


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: widget_control
Next Topic: Widget_Control

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 17:48:17 PDT 2025

Total time taken to generate the page: 0.00487 seconds