string(s, format='(a)') on empty strings

28 views
Skip to first unread message

markus.sc...@gmail.com

unread,
Jul 21, 2026, 11:42:04 AMJul 21
to idl-pvwave
Hi all, 
is it deliberate, that  string(s, format='(a)')  on a string array returns a shorter array, if some entries are empty strings?
IDL> s=strtrim(sindgen(3),2)
IDL> s[1]=''                
IDL> print,s,format='(a)'  
0

2
IDL> string(s, format='(a)')
0
2
IDL> string(s, format='(a0)')
0
2
IDL> string(s, format='(a3)')
  0
   
  2

If yes, is this documented somewhere? I couldn't find it.
Best, Markus

Chris

unread,
Jul 30, 2026, 4:10:12 PM (12 days ago) Jul 30
to idl-pvwave
Hi Markus,
This is intentional behavior, although it isn't well documented. I have gone ahead and added some additional documentation for the next release.
Thanks for reporting this!
Cheers,
Chris
Reply all
Reply to author
Forward
0 new messages