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

Home » Public Forums » archive » Re: converting bytarr into strarr
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: converting bytarr into strarr [message #44508] Tue, 21 June 2005 16:11 Go to previous message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
Michael Wallace wrote:
> How about doing a two step conversion: byte -> integer -> string.
>
> IDL> a = bindgen(20, 40)
> IDL> b = string(a)
> IDL> c = string(fix(a))
> IDL> help, a, b, c
> A BYTE = Array[20, 40]
> B STRING = Array[40]
> C STRING = Array[20, 40]
>
>
> -Mike

Hi,

Yeah, that was the first thing that occurred to me too, but when you use STRING on a
non-byte input, all you get is the number as a string, rather than the ASCII byte code
converted to a string:

IDL> a = bindgen(2, 4) + 65B
IDL> b = string(a)
IDL> c = string(fix(a))
IDL> help, a, b, c
A BYTE = Array[2, 4]
B STRING = Array[4]
C STRING = Array[2, 4]
IDL> print, b
AB CD EF GH
IDL> print, c
65 66
67 68
69 70
71 72


paulv

--
Paul van Delst
CIMSS @ NOAA/NCEP/EMC
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: converting bytarr into strarr
Next Topic: Re: Swap even/odd elements in array

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

Current Time: Wed Oct 08 19:17:49 PDT 2025

Total time taken to generate the page: 0.00460 seconds