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

Home » Public Forums » archive » Re: HDF Data sets containg strings?
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: HDF Data sets containg strings? [message #13306 is a reply to message #13302] Mon, 02 November 1998 00:00 Go to previous messageGo to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Martin Schultz (mgs@io.harvard.edu) writes:

> prompts me to adevrtise my str2byte function that may help you getting byte
> arrays with fixed length from strings with variable length. Please find it
> attached below.

I can see some applications for Martin's Str2Byte function,
but I wanted to remind you of something I learned from Ray
Sterner a long time ago: if you have a string array
with strings of variable lengths, you can easily turn that
into a 2D byte array, in which each string is as long as
the longest string in the array by using the BYTE function.

a = StrArr(4)
a[0] = 'hello'
a[1] = 'my name is coyote'
a[2] = 'what is yours?'
a[3] = 'bye'
done = Byte(a)
Help, done
DONE BYTE = Array[17, 4]

Not only that, but they come back out properly!

Print, String(done[*,0])
hello

Print, StrLen(String(done[*,0]))
5

Cheers,

David

----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438, Toll-Free Book Orders: 1-888-461-0155
Coyote's Guide to IDL Programming: http://www.dfanning.com/
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Differences between ' and ", syntax error (bug?)
Next Topic: Re: Object Surface Shaded by Elevation (LONG)

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

Current Time: Sun Oct 12 04:47:00 PDT 2025

Total time taken to generate the page: 3.35969 seconds