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

Home » Public Forums » archive » Re: Removing the blanks between elements in a 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: Removing the blanks between elements in a string array [message #69712 is a reply to message #69711] Fri, 29 January 2010 20:46 Go to previous message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On Jan 30, 2:31 am, "sulli.jj" <sulli...@gmail.com> wrote:
> Does anyone know a easy to way to print out an array with no blanks at
> all?
>
> I have an array of strings like
> a = [['  cat,','d o g,','bi    rd   ' ],[' 1.23,   ',' 4.  56,','
> 7.89   ']]
>
> print, a
>   cat, d o g, bi    rd
>  1.23,     4.  56,  7.89
>
> I can remove most of the spaces with,
>
> print, STRCOMPRESS(a, /REMOVE_ALL)
> cat, dog, bird
> 1.23, 4.56, 7.89
>

There are no blanks in the array from strcompress with remove_all. The
spaces between elements are put there by print's default format.

Two ways to get what you want are

print,strcompress(a,/remove_all),format='(3A0)'

print,strjoin(strcompress(a,/remove_all)),format='(A0)'
[Message index]
 
Read Message
Read Message
Previous Topic: Removing the blanks between elements in a string array
Next Topic: Simple question about the '>' sign.

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

Current Time: Thu Oct 16 21:27:59 PDT 2025

Total time taken to generate the page: 3.43694 seconds